browser-debugger-cli 0.8.0 → 0.9.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.
Files changed (251) hide show
  1. package/README.md +4 -1
  2. package/dist/cdp/schema.d.ts +4 -1
  3. package/dist/cdp/schema.js +48 -7
  4. package/dist/commands/cdp.js +3 -2
  5. package/dist/commands/cleanup.d.ts +11 -0
  6. package/dist/commands/cleanup.js +161 -57
  7. package/dist/commands/console.d.ts +20 -1
  8. package/dist/commands/console.js +57 -17
  9. package/dist/commands/details.js +3 -2
  10. package/dist/commands/dom/DomElementResolver.d.ts +10 -3
  11. package/dist/commands/dom/DomElementResolver.js +35 -17
  12. package/dist/commands/dom/a11y.d.ts +10 -0
  13. package/dist/commands/dom/a11y.js +27 -5
  14. package/dist/commands/dom/eval.d.ts +3 -1
  15. package/dist/commands/dom/eval.js +29 -4
  16. package/dist/commands/dom/form.js +16 -62
  17. package/dist/commands/dom/formInteraction.js +152 -113
  18. package/dist/commands/dom/formSummary.d.ts +49 -0
  19. package/dist/commands/dom/formSummary.js +180 -0
  20. package/dist/commands/dom/frames.d.ts +2 -1
  21. package/dist/commands/dom/frames.js +17 -2
  22. package/dist/commands/dom/get.d.ts +6 -5
  23. package/dist/commands/dom/get.js +92 -82
  24. package/dist/commands/dom/helpers/index.d.ts +1 -1
  25. package/dist/commands/dom/helpers/index.js +1 -1
  26. package/dist/commands/dom/helpers/query.d.ts +44 -17
  27. package/dist/commands/dom/helpers/query.js +244 -97
  28. package/dist/commands/dom/helpers/runElementCommand.d.ts +10 -2
  29. package/dist/commands/dom/helpers/runElementCommand.js +97 -30
  30. package/dist/commands/dom/helpers/screenshot.d.ts +4 -1
  31. package/dist/commands/dom/helpers/screenshot.js +164 -49
  32. package/dist/commands/dom/index.d.ts +3 -1
  33. package/dist/commands/dom/index.js +16 -6
  34. package/dist/commands/dom/layout.d.ts +14 -0
  35. package/dist/commands/dom/layout.js +54 -0
  36. package/dist/commands/dom/listeners.d.ts +5 -1
  37. package/dist/commands/dom/listeners.js +13 -3
  38. package/dist/commands/dom/query.js +2 -3
  39. package/dist/commands/dom/screenshot.d.ts +12 -2
  40. package/dist/commands/dom/screenshot.js +27 -3
  41. package/dist/commands/dom/semanticUtils.d.ts +6 -13
  42. package/dist/commands/dom/semanticUtils.js +15 -19
  43. package/dist/commands/dom/wait.d.ts +13 -0
  44. package/dist/commands/dom/wait.js +83 -0
  45. package/dist/commands/helpJson.js +2 -2
  46. package/dist/commands/network/list.js +4 -11
  47. package/dist/commands/optionBehaviors.js +112 -21
  48. package/dist/commands/page.d.ts +2 -1
  49. package/dist/commands/page.js +41 -5
  50. package/dist/commands/peek.js +4 -11
  51. package/dist/commands/sessions.d.ts +8 -0
  52. package/dist/commands/sessions.js +19 -0
  53. package/dist/commands/shared/CommandRunner.js +4 -4
  54. package/dist/commands/shared/dataFetcher.js +2 -2
  55. package/dist/commands/shared/followMode.d.ts +21 -1
  56. package/dist/commands/shared/followMode.js +29 -2
  57. package/dist/commands/shared/handleValidationError.d.ts +2 -2
  58. package/dist/commands/shared/handleValidationError.js +12 -3
  59. package/dist/commands/shared/optionTypes.d.ts +40 -5
  60. package/dist/commands/shared/startHelpers.js +12 -3
  61. package/dist/commands/shared/validation.d.ts +3 -2
  62. package/dist/commands/shared/validation.js +4 -3
  63. package/dist/commands/start.d.ts +63 -0
  64. package/dist/commands/start.js +115 -15
  65. package/dist/commands/status.js +29 -7
  66. package/dist/commands/stop.js +7 -6
  67. package/dist/commands/tail.js +4 -11
  68. package/dist/commands/types.d.ts +2 -0
  69. package/dist/commands.js +2 -0
  70. package/dist/connection/chromeIdentity.d.ts +65 -0
  71. package/dist/connection/chromeIdentity.js +143 -0
  72. package/dist/connection/launcher/profilePreferences.d.ts +47 -0
  73. package/dist/connection/launcher/profilePreferences.js +151 -0
  74. package/dist/connection/launcher.d.ts +21 -2
  75. package/dist/connection/launcher.js +42 -16
  76. package/dist/connection/portReservation.d.ts +14 -4
  77. package/dist/connection/portReservation.js +21 -6
  78. package/dist/connection/startupExit.d.ts +8 -0
  79. package/dist/connection/startupExit.js +15 -6
  80. package/dist/constants.d.ts +6 -2
  81. package/dist/constants.js +9 -2
  82. package/dist/daemon/SessionController.js +23 -7
  83. package/dist/daemon/errors.d.ts +1 -1
  84. package/dist/daemon/errors.js +1 -1
  85. package/dist/daemon/launcher.d.ts +2 -1
  86. package/dist/daemon/launcher.js +5 -6
  87. package/dist/daemon/server/SocketServer.js +1 -2
  88. package/dist/daemon/session/Session.d.ts +13 -0
  89. package/dist/daemon/session/Session.js +57 -8
  90. package/dist/daemon/session/chromeConnection.d.ts +9 -0
  91. package/dist/daemon/session/chromeConnection.js +45 -8
  92. package/dist/daemon/session/commandRegistry.js +52 -62
  93. package/dist/daemon/session/interactions.d.ts +35 -9
  94. package/dist/daemon/session/interactions.js +36 -9
  95. package/dist/daemon/session/triggeredRequests.d.ts +67 -0
  96. package/dist/daemon/session/triggeredRequests.js +157 -0
  97. package/dist/daemon/session/types.d.ts +5 -1
  98. package/dist/daemon.js +5393 -1600
  99. package/dist/errors/messages.d.ts +387 -24
  100. package/dist/errors/messages.js +761 -67
  101. package/dist/index.js +3976 -1558
  102. package/dist/ipc/client.d.ts +12 -1
  103. package/dist/ipc/client.js +22 -3
  104. package/dist/ipc/protocol/commands.d.ts +89 -4
  105. package/dist/ipc/protocol/commands.js +2 -0
  106. package/dist/ipc/protocol/domTypes.d.ts +258 -7
  107. package/dist/ipc/session/lifecycle.d.ts +8 -1
  108. package/dist/ipc/session/queries.d.ts +5 -1
  109. package/dist/ipc/session/types.d.ts +5 -0
  110. package/dist/ipc/transport/index.d.ts +2 -1
  111. package/dist/ipc/transport/index.js +2 -2
  112. package/dist/runtime/dom/actionEffects.d.ts +106 -0
  113. package/dist/runtime/dom/actionEffects.js +256 -0
  114. package/dist/runtime/dom/actionEffectsScripts.d.ts +52 -0
  115. package/dist/runtime/dom/actionEffectsScripts.js +234 -0
  116. package/dist/runtime/dom/elementGeometry.d.ts +170 -0
  117. package/dist/runtime/dom/elementGeometry.js +553 -0
  118. package/dist/runtime/dom/elementInfo.d.ts +77 -0
  119. package/dist/runtime/dom/elementInfo.js +191 -0
  120. package/dist/runtime/dom/evalHelpers.d.ts +51 -6
  121. package/dist/runtime/dom/evalHelpers.js +136 -26
  122. package/dist/runtime/dom/eventListeners.d.ts +2 -1
  123. package/dist/runtime/dom/eventListeners.js +174 -47
  124. package/dist/runtime/dom/formDiscovery.d.ts +1 -1
  125. package/dist/runtime/dom/formDiscovery.js +116 -16
  126. package/dist/runtime/dom/formFillHelpers/fill.d.ts +10 -0
  127. package/dist/runtime/dom/formFillHelpers/fill.js +125 -10
  128. package/dist/runtime/dom/formFillHelpers/index.d.ts +2 -2
  129. package/dist/runtime/dom/formFillHelpers/index.js +2 -2
  130. package/dist/runtime/dom/formFillHelpers/pressKey.js +14 -3
  131. package/dist/runtime/dom/formFillHelpers/scroll.d.ts +3 -0
  132. package/dist/runtime/dom/formFillHelpers/scroll.js +60 -18
  133. package/dist/runtime/dom/formFillHelpers/shared.d.ts +17 -0
  134. package/dist/runtime/dom/formFillHelpers/shared.js +25 -1
  135. package/dist/runtime/dom/formFillHelpers/stability.d.ts +20 -6
  136. package/dist/runtime/dom/formFillHelpers/stability.js +50 -19
  137. package/dist/runtime/dom/formSubmitHelpers.d.ts +3 -0
  138. package/dist/runtime/dom/formSubmitHelpers.js +89 -15
  139. package/dist/runtime/dom/frameLayout.d.ts +60 -0
  140. package/dist/runtime/dom/frameLayout.js +140 -0
  141. package/dist/runtime/dom/frameOrigin.d.ts +50 -0
  142. package/dist/runtime/dom/frameOrigin.js +62 -0
  143. package/dist/runtime/dom/frameScopedConnection.d.ts +92 -0
  144. package/dist/runtime/dom/frameScopedConnection.js +252 -0
  145. package/dist/runtime/dom/frameSelection.d.ts +1 -1
  146. package/dist/runtime/dom/frameSelection.js +2 -2
  147. package/dist/runtime/dom/frames.d.ts +25 -2
  148. package/dist/runtime/dom/frames.js +202 -63
  149. package/dist/runtime/dom/layout.d.ts +67 -0
  150. package/dist/runtime/dom/layout.js +333 -0
  151. package/dist/runtime/dom/listenerPageScripts.d.ts +66 -0
  152. package/dist/runtime/dom/listenerPageScripts.js +279 -0
  153. package/dist/runtime/dom/listenerSummary.d.ts +132 -11
  154. package/dist/runtime/dom/listenerSummary.js +344 -22
  155. package/dist/runtime/dom/pageActivity.d.ts +41 -0
  156. package/dist/runtime/dom/pageActivity.js +123 -0
  157. package/dist/runtime/dom/reactEventHelpers.d.ts +58 -2
  158. package/dist/runtime/dom/reactEventHelpers.js +212 -41
  159. package/dist/runtime/dom/targetNode.d.ts +80 -27
  160. package/dist/runtime/dom/targetNode.js +249 -33
  161. package/dist/runtime/dom/wait.d.ts +25 -0
  162. package/dist/runtime/dom/wait.js +199 -0
  163. package/dist/runtime/dom/waitCondition.d.ts +71 -0
  164. package/dist/runtime/dom/waitCondition.js +75 -0
  165. package/dist/runtime/page/emulation.d.ts +51 -0
  166. package/dist/runtime/page/emulation.js +80 -0
  167. package/dist/runtime/page/loadingState.d.ts +36 -0
  168. package/dist/runtime/page/loadingState.js +86 -0
  169. package/dist/runtime/page/navigation.d.ts +46 -2
  170. package/dist/runtime/page/navigation.js +69 -33
  171. package/dist/session/QueryCacheManager.d.ts +11 -1
  172. package/dist/session/QueryCacheManager.js +25 -3
  173. package/dist/session/chromeOwners.d.ts +34 -0
  174. package/dist/session/chromeOwners.js +51 -0
  175. package/dist/session/cleanup/staleSession.d.ts +11 -1
  176. package/dist/session/cleanup/staleSession.js +17 -6
  177. package/dist/session/cleanup/userCommands.js +2 -4
  178. package/dist/session/metadata.d.ts +5 -1
  179. package/dist/session/metadata.js +2 -1
  180. package/dist/session/paths.d.ts +77 -3
  181. package/dist/session/paths.js +111 -5
  182. package/dist/session/port.d.ts +31 -7
  183. package/dist/session/port.js +50 -43
  184. package/dist/session/portClaims.d.ts +66 -0
  185. package/dist/session/portClaims.js +284 -0
  186. package/dist/session/sessionList.d.ts +58 -0
  187. package/dist/session/sessionList.js +199 -0
  188. package/dist/session/sessionName.d.ts +46 -0
  189. package/dist/session/sessionName.js +97 -0
  190. package/dist/telemetry/a11y.d.ts +8 -3
  191. package/dist/telemetry/a11y.js +92 -28
  192. package/dist/telemetry/requestKinds.d.ts +32 -0
  193. package/dist/telemetry/requestKinds.js +61 -0
  194. package/dist/telemetry/requestState.d.ts +31 -0
  195. package/dist/telemetry/requestState.js +38 -0
  196. package/dist/types.d.ts +80 -3
  197. package/dist/ui/formatters/a11y.js +3 -0
  198. package/dist/ui/formatters/console/chronological.d.ts +8 -0
  199. package/dist/ui/formatters/console/chronological.js +17 -4
  200. package/dist/ui/formatters/console/json.js +3 -4
  201. package/dist/ui/formatters/console/shared.d.ts +12 -0
  202. package/dist/ui/formatters/console.d.ts +2 -2
  203. package/dist/ui/formatters/console.js +1 -1
  204. package/dist/ui/formatters/details.js +2 -1
  205. package/dist/ui/formatters/dom.d.ts +26 -14
  206. package/dist/ui/formatters/dom.js +65 -52
  207. package/dist/ui/formatters/form.js +29 -18
  208. package/dist/ui/formatters/layout.d.ts +31 -0
  209. package/dist/ui/formatters/layout.js +53 -0
  210. package/dist/ui/formatters/listeners.d.ts +3 -2
  211. package/dist/ui/formatters/listeners.js +73 -9
  212. package/dist/ui/formatters/networkHeaders.js +13 -0
  213. package/dist/ui/formatters/preview.js +2 -1
  214. package/dist/ui/formatters/requestStatus.d.ts +1 -17
  215. package/dist/ui/formatters/requestStatus.js +2 -30
  216. package/dist/ui/formatters/sessions.d.ts +12 -0
  217. package/dist/ui/formatters/sessions.js +40 -0
  218. package/dist/ui/formatters/status.d.ts +21 -2
  219. package/dist/ui/formatters/status.js +47 -10
  220. package/dist/ui/formatters/triggeredRequests.d.ts +36 -0
  221. package/dist/ui/formatters/triggeredRequests.js +65 -0
  222. package/dist/ui/formatting.d.ts +10 -0
  223. package/dist/ui/formatting.js +28 -36
  224. package/dist/ui/messages/chrome.d.ts +9 -0
  225. package/dist/ui/messages/chrome.js +17 -5
  226. package/dist/ui/messages/commands.d.ts +388 -14
  227. package/dist/ui/messages/commands.js +664 -21
  228. package/dist/ui/messages/consoleMessages.d.ts +10 -0
  229. package/dist/ui/messages/consoleMessages.js +17 -0
  230. package/dist/ui/messages/hints.js +2 -1
  231. package/dist/ui/messages/preview.js +5 -4
  232. package/dist/ui/messages/session.d.ts +16 -21
  233. package/dist/ui/messages/session.js +28 -26
  234. package/dist/ui/messages/sessionCommand.d.ts +43 -0
  235. package/dist/ui/messages/sessionCommand.js +52 -0
  236. package/dist/utils/async.d.ts +8 -0
  237. package/dist/utils/async.js +19 -0
  238. package/dist/utils/http.d.ts +22 -1
  239. package/dist/utils/http.js +28 -9
  240. package/dist/utils/selectorFilters.d.ts +36 -8
  241. package/dist/utils/selectorFilters.js +267 -53
  242. package/dist/utils/shellDetection.d.ts +8 -2
  243. package/dist/utils/shellDetection.js +120 -33
  244. package/dist/utils/suggestions.d.ts +26 -0
  245. package/dist/utils/suggestions.js +73 -0
  246. package/dist/utils/taskMappings.js +10 -0
  247. package/dist/utils/url.d.ts +12 -2
  248. package/dist/utils/url.js +69 -7
  249. package/package.json +1 -1
  250. package/dist/ui/formatters/sessionFormatters.d.ts +0 -58
  251. package/dist/ui/formatters/sessionFormatters.js +0 -121
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Lifecycle state of captured network requests.
3
+ *
4
+ * A request is pending until it completes or fails. Status 0 means it failed
5
+ * without any response (DNS, refused, aborted, blocked); a request that got a
6
+ * response keeps its HTTP status even if loading failed afterwards.
7
+ */
8
+ import type { NetworkRequest } from '../types.js';
9
+ /** Lifecycle state of a captured request. */
10
+ export type RequestState = 'pending' | 'failed' | 'complete';
11
+ /**
12
+ * Classify a request.
13
+ *
14
+ * @param request - Captured request
15
+ * @returns Its lifecycle state
16
+ */
17
+ export declare function getRequestState(request: Pick<NetworkRequest, 'status'>): RequestState;
18
+ /**
19
+ * Why a request failed, leaving out Chrome stopping an unneeded body after a
20
+ * complete response (204/304 report `net::ERR_ABORTED` that way).
21
+ *
22
+ * @param request - Captured request
23
+ * @returns Reason, or undefined when there is none worth showing
24
+ */
25
+ export declare function failureReason(request: Pick<NetworkRequest, 'status' | 'errorText'>): string | undefined;
26
+ /**
27
+ * Error Chrome reports when it stops reading a response body nobody needs
28
+ * (the response itself arrived; not a failure of the request).
29
+ */
30
+ export declare const BODY_ABORTED = "net::ERR_ABORTED";
31
+ //# sourceMappingURL=requestState.d.ts.map
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Lifecycle state of captured network requests.
3
+ *
4
+ * A request is pending until it completes or fails. Status 0 means it failed
5
+ * without any response (DNS, refused, aborted, blocked); a request that got a
6
+ * response keeps its HTTP status even if loading failed afterwards.
7
+ */
8
+ /**
9
+ * Classify a request.
10
+ *
11
+ * @param request - Captured request
12
+ * @returns Its lifecycle state
13
+ */
14
+ export function getRequestState(request) {
15
+ if (request.status === undefined)
16
+ return 'pending';
17
+ return request.status === 0 ? 'failed' : 'complete';
18
+ }
19
+ /**
20
+ * Why a request failed, leaving out Chrome stopping an unneeded body after a
21
+ * complete response (204/304 report `net::ERR_ABORTED` that way).
22
+ *
23
+ * @param request - Captured request
24
+ * @returns Reason, or undefined when there is none worth showing
25
+ */
26
+ export function failureReason(request) {
27
+ if (!request.errorText)
28
+ return undefined;
29
+ return getRequestState(request) === 'complete' && request.errorText === BODY_ABORTED
30
+ ? undefined
31
+ : request.errorText;
32
+ }
33
+ /**
34
+ * Error Chrome reports when it stops reading a response body nobody needs
35
+ * (the response itself arrived; not a failure of the request).
36
+ */
37
+ export const BODY_ABORTED = 'net::ERR_ABORTED';
38
+ //# sourceMappingURL=requestState.js.map
package/dist/types.d.ts CHANGED
@@ -301,10 +301,12 @@ export interface A11yQueryPattern {
301
301
  * Result from A11y query operation.
302
302
  */
303
303
  export interface A11yQueryResult {
304
- /** Matching nodes */
304
+ /** Matching nodes (the first `--limit` of them) */
305
305
  nodes: A11yNode[];
306
306
  /** Total matches found */
307
307
  count: number;
308
+ /** Matches not listed because of `--limit` (their indices still work) */
309
+ omitted?: number;
308
310
  /** Query pattern used */
309
311
  pattern: A11yQueryPattern;
310
312
  }
@@ -316,6 +318,12 @@ export interface DomContext {
316
318
  tag: string;
317
319
  classes?: string[];
318
320
  preview?: string;
321
+ /** Up to 500 characters of text, when it is longer than the preview */
322
+ text?: string;
323
+ /** First child elements (`tag#id.class`), for an element without text */
324
+ children?: string[];
325
+ /** Number of child elements, for an element without text */
326
+ childCount?: number;
319
327
  }
320
328
  /**
321
329
  * Reference to a DOM node for CDP calls: a per-connection `nodeId` (valid only
@@ -326,6 +334,47 @@ export type NodeRef = {
326
334
  } | {
327
335
  backendNodeId: number;
328
336
  };
337
+ /** `prefers-color-scheme` value a session emulates (`--color-scheme`) */
338
+ export type ColorScheme = 'light' | 'dark';
339
+ /** Viewport size in CSS px (`--viewport`) */
340
+ export interface ViewportSize {
341
+ width: number;
342
+ height: number;
343
+ }
344
+ /**
345
+ * The page (document) request an action sent, as far as it got: still
346
+ * pending, answered with a status, or failed.
347
+ */
348
+ export interface DocumentRequestState {
349
+ method: string;
350
+ url: string;
351
+ /** How long it has been running (pending requests) */
352
+ pendingMs?: number;
353
+ /** HTTP status of the response, once answered */
354
+ status?: number;
355
+ statusText?: string;
356
+ /** Network error, when it failed */
357
+ errorText?: string;
358
+ }
359
+ /**
360
+ * The list a numeric index refers to: the results of the last
361
+ * `bdg dom query`, `bdg dom form` or `bdg dom a11y query` (one cache holds
362
+ * the last of them).
363
+ */
364
+ export interface IndexSource {
365
+ /** The index the user gave (0-based) */
366
+ index: number;
367
+ /** Command whose results are cached */
368
+ command: 'dom query' | 'dom form' | 'dom a11y query';
369
+ /** The query's selector or a11y pattern (not for `dom form`) */
370
+ query?: string;
371
+ }
372
+ /**
373
+ * Where an element is relative to the top-level viewport: fully `visible`,
374
+ * `partly` visible, outside it in one direction, or `hidden` (not rendered,
375
+ * `visibility: hidden`, zero size, inert, or clipped away).
376
+ */
377
+ export type ViewportPosition = 'visible' | 'partly' | 'above' | 'below' | 'left' | 'right' | 'hidden';
329
378
  /**
330
379
  * Result of a DOM query operation.
331
380
  */
@@ -341,11 +390,17 @@ export interface DomQueryResult {
341
390
  id?: string;
342
391
  name?: string;
343
392
  type?: string;
393
+ /** `value` attribute of an `<option>` */
394
+ value?: string;
344
395
  classes?: string[];
345
396
  /** Text content preview (display only, never used for targeting) */
346
397
  preview?: string;
347
398
  /** Enclosing iframe(s) and shadow root, e.g. "iframe#pay > shadow root of <x-card>" */
348
399
  context?: string;
400
+ /** Where the element is relative to the viewport when queried (first 100 matches) */
401
+ inViewport?: ViewportPosition;
402
+ /** Ancestor or iframe cutting it off, e.g. a scrolled list */
403
+ clippedBy?: string;
349
404
  /** Unique selector for this node (set by form discovery) */
350
405
  selector?: string;
351
406
  }>;
@@ -389,7 +444,13 @@ export interface ScreenshotResult {
389
444
  element?: {
390
445
  selector?: string;
391
446
  index?: number;
447
+ /** Border box of the element (page coordinates for element captures) */
392
448
  bounds: ElementBounds;
449
+ /**
450
+ * Area captured, when content overflowing the element (floats, positioned
451
+ * descendants) made it larger than the border box
452
+ */
453
+ captured?: ElementBounds;
393
454
  };
394
455
  /** Capture mode used */
395
456
  captureMode?: 'full_page' | 'viewport';
@@ -473,6 +534,8 @@ export interface FormField {
473
534
  name: string | null;
474
535
  placeholder?: string | undefined;
475
536
  required: boolean;
537
+ /** Name of the radio/checkbox group the field belongs to (counted once in the summary) */
538
+ groupLabel?: string | undefined;
476
539
  disabled: boolean;
477
540
  readOnly: boolean;
478
541
  hidden: boolean;
@@ -509,7 +572,9 @@ export interface FormBlocker {
509
572
  command: string;
510
573
  }
511
574
  /**
512
- * Summary statistics for a form.
575
+ * Summary statistics for a form. Counts cover the visible, editable fields;
576
+ * a radio or checkbox group (same name) counts once, filled when any of its
577
+ * options is checked.
513
578
  */
514
579
  export interface FormSummary {
515
580
  totalFields: number;
@@ -520,6 +585,12 @@ export interface FormSummary {
520
585
  requiredTotal: number;
521
586
  requiredFilled: number;
522
587
  requiredRemaining: number;
588
+ /** Labels of the fields (choice groups once) left empty, required or not */
589
+ emptyFieldLabels: string[];
590
+ /**
591
+ * Every required field is filled, nothing is invalid, the submit button is
592
+ * enabled, and at least one field is filled (or the form has none)
593
+ */
523
594
  readyToSubmit: boolean;
524
595
  blockers: FormBlocker[];
525
596
  }
@@ -540,6 +611,10 @@ export interface DiscoveredForm {
540
611
  method: string;
541
612
  step?: FormStep | undefined;
542
613
  relevanceScore: number;
614
+ /** Not visible (not rendered, visibility-hidden, or all its fields are) */
615
+ hidden: boolean;
616
+ /** Shown inside an open dialog: listed first, like visible forms before hidden ones */
617
+ inDialog: boolean;
543
618
  fields: FormField[];
544
619
  buttons: FormButton[];
545
620
  summary: FormSummary;
@@ -551,11 +626,13 @@ export interface FormDiscoveryResult {
551
626
  formCount: number;
552
627
  selectedForm: number;
553
628
  forms: DiscoveredForm[];
554
- /** The forms not shown (without `--all`): name and number of visible fields */
629
+ /** The forms not shown (without `--all`): name and number of visible fields (all fields of a hidden form) */
555
630
  otherForms?: Array<{
556
631
  index: number;
557
632
  name: string | null;
558
633
  fieldCount: number;
634
+ hidden: boolean;
635
+ inDialog: boolean;
559
636
  }>;
560
637
  brief?: boolean | undefined;
561
638
  }
@@ -1,4 +1,5 @@
1
1
  import { OutputFormatter, areHintsHidden } from '../formatting.js';
2
+ import { a11yMoreMatchesNote } from '../messages/commands.js';
2
3
  /**
3
4
  * Maximum number of nodes to display in tree output before truncating.
4
5
  * Prevents overwhelming terminal output for large accessibility trees.
@@ -111,6 +112,8 @@ export function formatA11yQueryResult(result) {
111
112
  const index = node.index !== undefined ? `[${node.index}] ` : '';
112
113
  fmt.text(index + formatA11yNodeOneLine(node)).blank();
113
114
  }
115
+ if (result.omitted)
116
+ fmt.text(a11yMoreMatchesNote(result.omitted)).blank();
114
117
  const first = result.nodes[0];
115
118
  if (first?.index !== undefined && !areHintsHidden()) {
116
119
  const fillable = FILLABLE_ROLES.has(first.role.toLowerCase());
@@ -11,4 +11,12 @@ import { type ConsoleFormatOptions } from './shared.js';
11
11
  * navigation markers when page reloads are detected.
12
12
  */
13
13
  export declare function formatConsoleChronological(messages: ConsoleMessage[], options: ConsoleFormatOptions): string;
14
+ /**
15
+ * The messages `--last` selects: the last N (all for 0 or none).
16
+ *
17
+ * @param messages - Messages after the page and level filters
18
+ * @param last - `--last` value
19
+ * @returns The messages to list
20
+ */
21
+ export declare function lastMessages(messages: ConsoleMessage[], last: number | undefined): ConsoleMessage[];
14
22
  //# sourceMappingURL=chronological.d.ts.map
@@ -3,6 +3,7 @@
3
3
  * level prefixes, and navigation reload markers.
4
4
  */
5
5
  import { OutputFormatter } from '../../formatting.js';
6
+ import { consoleIndexGapNote } from '../../messages/consoleMessages.js';
6
7
  import { truncateByLength } from '../../../utils/strings.js';
7
8
  import { formatSourceLocation, formatTimestamp } from './shared.js';
8
9
  const MAX_LIST_TEXT_LENGTH = 200;
@@ -14,10 +15,7 @@ const MAX_LIST_TEXT_LENGTH = 200;
14
15
  */
15
16
  export function formatConsoleChronological(messages, options) {
16
17
  const fmt = new OutputFormatter();
17
- let displayMessages = messages;
18
- if (options.last && options.last > 0) {
19
- displayMessages = messages.slice(-options.last);
20
- }
18
+ const displayMessages = lastMessages(messages, options.last);
21
19
  const headerSuffix = options.history ? ' (all navigations)' : '';
22
20
  const header = displayMessages.length === messages.length
23
21
  ? `Console Messages (${messages.length} total)${headerSuffix}`
@@ -53,6 +51,21 @@ export function formatConsoleChronological(messages, options) {
53
51
  fmt.text(`${sourceIndent}→ ${source}`);
54
52
  }
55
53
  }
54
+ const { skipped } = options;
55
+ if (skipped && skipped.otherPages + skipped.otherLevels > 0) {
56
+ fmt.blank();
57
+ fmt.text(consoleIndexGapNote(skipped));
58
+ }
56
59
  return fmt.build();
57
60
  }
61
+ /**
62
+ * The messages `--last` selects: the last N (all for 0 or none).
63
+ *
64
+ * @param messages - Messages after the page and level filters
65
+ * @param last - `--last` value
66
+ * @returns The messages to list
67
+ */
68
+ export function lastMessages(messages, last) {
69
+ return last && last > 0 ? messages.slice(-last) : messages;
70
+ }
58
71
  //# sourceMappingURL=chronological.js.map
@@ -3,6 +3,7 @@
3
3
  * deduplicated errors/warnings; full message list is included only when
4
4
  * --list is set.
5
5
  */
6
+ import { lastMessages } from './chronological.js';
6
7
  import { analyzeMessages, } from './shared.js';
7
8
  function toJsonError(dedup, includeStackTrace) {
8
9
  const source = dedup.message.stackTrace?.[0];
@@ -37,10 +38,8 @@ export function buildConsoleJsonOutput(messages, options) {
37
38
  errors: grouped.errors.map((d) => toJsonError(d, true)),
38
39
  warnings: grouped.warnings.map((d) => toJsonError(d, false)),
39
40
  };
40
- if (options.list) {
41
- const displayMessages = options.last && options.last > 0 ? messages.slice(-options.last) : messages;
42
- output.messages = displayMessages;
43
- }
41
+ if (options.list)
42
+ output.messages = lastMessages(messages, options.last);
44
43
  return output;
45
44
  }
46
45
  /**
@@ -55,6 +55,18 @@ export interface ConsoleFormatOptions {
55
55
  history?: boolean | undefined;
56
56
  /** Filter by level (error, warning, info, debug) */
57
57
  level?: ConsoleLevel | undefined;
58
+ /** Messages between the first and last listed index that the filters left out */
59
+ skipped?: ConsoleSkipped | undefined;
60
+ }
61
+ /**
62
+ * Messages the page and level filters left out between the first and last
63
+ * listed index (session indices then skip numbers).
64
+ */
65
+ export interface ConsoleSkipped {
66
+ /** Logged by another page load (`--history` lists them) */
67
+ otherPages: number;
68
+ /** Of another level (`--level`) */
69
+ otherLevels: number;
58
70
  }
59
71
  /**
60
72
  * JSON error/warning entry structure.
@@ -7,9 +7,9 @@
7
7
  */
8
8
  import type { ConsoleMessage } from '../../types.js';
9
9
  import { type ConsoleFormatOptions } from './console/shared.js';
10
- export type { ConsoleFormatOptions, ConsoleJsonOutput, ConsoleLevel, ConsoleSummary, DeduplicatedMessage, } from './console/shared.js';
10
+ export type { ConsoleFormatOptions, ConsoleJsonOutput, ConsoleLevel, ConsoleSkipped, ConsoleSummary, DeduplicatedMessage, } from './console/shared.js';
11
11
  export { LEVEL_MAP } from './console/shared.js';
12
- export { formatConsoleChronological } from './console/chronological.js';
12
+ export { formatConsoleChronological, lastMessages } from './console/chronological.js';
13
13
  export { formatConsoleFollowLines } from './console/follow.js';
14
14
  export { buildConsoleJsonOutput, formatConsoleJson } from './console/json.js';
15
15
  export { formatConsoleSummary } from './console/summarize.js';
@@ -9,7 +9,7 @@ import { formatConsoleChronological } from './console/chronological.js';
9
9
  import { formatConsoleJson } from './console/json.js';
10
10
  import { formatConsoleSummary } from './console/summarize.js';
11
11
  export { LEVEL_MAP } from './console/shared.js';
12
- export { formatConsoleChronological } from './console/chronological.js';
12
+ export { formatConsoleChronological, lastMessages } from './console/chronological.js';
13
13
  export { formatConsoleFollowLines } from './console/follow.js';
14
14
  export { buildConsoleJsonOutput, formatConsoleJson } from './console/json.js';
15
15
  export { formatConsoleSummary } from './console/summarize.js';
@@ -2,6 +2,7 @@ import { skippedBodyReason } from '../../telemetry/network.js';
2
2
  import { formatFramePosition, formatTimestamp } from './console/shared.js';
3
3
  import { formatRequestStatus } from './requestStatus.js';
4
4
  import { OutputFormatter } from '../formatting.js';
5
+ import { sessionCommand } from '../messages/sessionCommand.js';
5
6
  import { truncateByLength } from '../../utils/strings.js';
6
7
  /** Characters of each WebSocket message shown in human output (`--json` has all) */
7
8
  const MESSAGE_PREVIEW_LENGTH = 200;
@@ -155,7 +156,7 @@ function describeResponseBody(request) {
155
156
  const body = request.responseBody;
156
157
  if (body.length <= BODY_PREVIEW_LENGTH)
157
158
  return body;
158
- return `${body.slice(0, BODY_PREVIEW_LENGTH)}\n… ${body.length - BODY_PREVIEW_LENGTH} more characters (full body: bdg details network ${request.requestId} --json)`;
159
+ return `${body.slice(0, BODY_PREVIEW_LENGTH)}\n… ${body.length - BODY_PREVIEW_LENGTH} more characters (full body: ${sessionCommand(`bdg details network ${request.requestId} --json`)})`;
159
160
  }
160
161
  /**
161
162
  * Format network request details for human-readable output.
@@ -3,10 +3,11 @@ import type { DomQueryResult, DomGetResult, ScreenshotResult } from '../../types
3
3
  /**
4
4
  * Format DOM query results for human-readable output.
5
5
  *
6
- * Displays found nodes with their index, tag, classes, and preview text,
7
- * up to {@link QUERY_DISPLAY_LIMIT} of them (no match is an error, exit 83).
8
- * The text extraction hint is left out for selectors with text or visibility
9
- * filters, which `document.querySelectorAll` does not understand.
6
+ * Displays found nodes with their index, tag, classes, and preview text
7
+ * (plus where they are when outside the viewport or hidden, e.g.
8
+ * `(below fold)`), up to {@link QUERY_DISPLAY_LIMIT} of them (no match is an error, exit 83).
9
+ * One line of next commands follows; they take the match's index, so they
10
+ * work for matches in shadow roots and iframes too.
10
11
  *
11
12
  * @param data - DOM query result containing selector, count, and matching nodes
12
13
  * @returns Formatted output string
@@ -61,18 +62,23 @@ export declare function formatDomGet(data: DomGetResult): string;
61
62
  /**
62
63
  * Format DOM eval results for human-readable output.
63
64
  *
64
- * Outputs the evaluated JavaScript result as formatted JSON, preceded by a
65
- * `Frame: <url>` line when it ran in an iframe (`--frame`).
65
+ * A string result is printed as is (not JSON-quoted), so text reads and
66
+ * pipes like `echo`, unless that would read as another value (empty,
67
+ * `undefined`, or valid JSON such as `42` or `[1,2]`): then it stays
68
+ * JSON-quoted. Other values are formatted JSON, and values Chrome only
69
+ * describes (functions, DOM nodes) their description. The iframe it ran in
70
+ * (`--frame`) is reported on stderr, so stdout stays the bare value. `--json`
71
+ * output is unchanged (the value in `data.result`).
66
72
  *
67
- * @param data - DOM eval result containing the evaluated value (and its frame)
68
- * @returns Formatted JSON string
73
+ * @param data - DOM eval result containing the evaluated value
74
+ * @returns The string, or formatted JSON
69
75
  *
70
76
  * @example
71
77
  * ```typescript
72
- * formatDomEval({ result: 'My Page Title' });
73
- * // Output: "My Page Title"
78
+ * formatDomEval({ result: 'My Page Title', type: 'string' });
79
+ * // Output: My Page Title
74
80
  *
75
- * formatDomEval({ result: { url: 'https://example.com', title: 'Example' } });
81
+ * formatDomEval({ result: { url: 'https://example.com', title: 'Example' }, type: 'object' });
76
82
  * // Output:
77
83
  * // {
78
84
  * // "url": "https://example.com",
@@ -83,22 +89,25 @@ export declare function formatDomGet(data: DomGetResult): string;
83
89
  export declare function formatDomEval(data: {
84
90
  result: unknown;
85
91
  type?: string;
86
- frame?: string;
87
92
  }): string;
88
93
  /**
89
- * Format the page's iframes, one per line.
94
+ * Format the page's iframes, one per line, nested frames indented below
95
+ * their parent. While the page is still loading (`readyState` set), the list
96
+ * may be incomplete, and says so.
90
97
  *
91
- * @param data - Frames from `bdg dom frames`
98
+ * @param data - Frames from `bdg dom frames`, with the readyState of a page still loading
92
99
  * @returns Formatted list
93
100
  *
94
101
  * @example
95
102
  * ```
96
103
  * [0] http://localhost:3000/widget name=widget same-origin
97
104
  * [1] https://pay.example/ #checkout cross-origin, out-of-process
105
+ * [2] about:blank same-origin
98
106
  * ```
99
107
  */
100
108
  export declare function formatDomFrames(data: {
101
109
  frames: DomFrame[];
110
+ readyState?: string;
102
111
  }): string;
103
112
  /**
104
113
  * Format screenshot capture result for human-readable display.
@@ -115,6 +124,9 @@ export declare function formatDomFrames(data: {
115
124
  *
116
125
  * formatDomScreenshot({ path: './page.png', fullPageSkipped: { reason: 'page_too_tall', ... } });
117
126
  * // Output: Screenshot saved to ./page.png (viewport only - page too tall)
127
+ *
128
+ * // An element whose floated children overflow it
129
+ * // Output: Screenshot saved to ./el.png (grown from 940×37 to 940×285 to include content overflowing the element)
118
130
  * ```
119
131
  */
120
132
  export declare function formatDomScreenshot(data: ScreenshotResult): string;