browser-debugger-cli 0.8.0 → 0.10.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 (304) hide show
  1. package/README.md +7 -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 +29 -6
  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 +189 -119
  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/keyAttributes.d.ts +20 -0
  27. package/dist/commands/dom/helpers/keyAttributes.js +54 -0
  28. package/dist/commands/dom/helpers/query.d.ts +44 -17
  29. package/dist/commands/dom/helpers/query.js +300 -106
  30. package/dist/commands/dom/helpers/runElementCommand.d.ts +10 -2
  31. package/dist/commands/dom/helpers/runElementCommand.js +98 -30
  32. package/dist/commands/dom/helpers/screenshot.d.ts +4 -1
  33. package/dist/commands/dom/helpers/screenshot.js +239 -51
  34. package/dist/commands/dom/index.d.ts +4 -1
  35. package/dist/commands/dom/index.js +22 -7
  36. package/dist/commands/dom/inspect.d.ts +15 -0
  37. package/dist/commands/dom/inspect.js +82 -0
  38. package/dist/commands/dom/layout.d.ts +14 -0
  39. package/dist/commands/dom/layout.js +54 -0
  40. package/dist/commands/dom/listeners.d.ts +5 -1
  41. package/dist/commands/dom/listeners.js +15 -5
  42. package/dist/commands/dom/query.js +2 -3
  43. package/dist/commands/dom/screenshot.d.ts +12 -2
  44. package/dist/commands/dom/screenshot.js +27 -3
  45. package/dist/commands/dom/semanticUtils.d.ts +16 -10
  46. package/dist/commands/dom/semanticUtils.js +53 -16
  47. package/dist/commands/dom/wait.d.ts +13 -0
  48. package/dist/commands/dom/wait.js +83 -0
  49. package/dist/commands/helpJson.js +2 -2
  50. package/dist/commands/network/list.js +17 -13
  51. package/dist/commands/optionBehaviors.js +154 -21
  52. package/dist/commands/page.d.ts +3 -2
  53. package/dist/commands/page.js +100 -5
  54. package/dist/commands/peek.js +4 -11
  55. package/dist/commands/sessions.d.ts +8 -0
  56. package/dist/commands/sessions.js +19 -0
  57. package/dist/commands/shared/CommandRunner.js +4 -4
  58. package/dist/commands/shared/commonOptions.d.ts +4 -0
  59. package/dist/commands/shared/commonOptions.js +9 -0
  60. package/dist/commands/shared/dataFetcher.js +2 -2
  61. package/dist/commands/shared/followMode.d.ts +21 -1
  62. package/dist/commands/shared/followMode.js +29 -2
  63. package/dist/commands/shared/handleValidationError.d.ts +2 -2
  64. package/dist/commands/shared/handleValidationError.js +12 -3
  65. package/dist/commands/shared/optionTypes.d.ts +61 -5
  66. package/dist/commands/shared/startHelpers.d.ts +66 -0
  67. package/dist/commands/shared/startHelpers.js +103 -13
  68. package/dist/commands/shared/validation.d.ts +14 -2
  69. package/dist/commands/shared/validation.js +20 -3
  70. package/dist/commands/start.d.ts +63 -0
  71. package/dist/commands/start.js +115 -15
  72. package/dist/commands/status.js +29 -7
  73. package/dist/commands/stop.js +7 -6
  74. package/dist/commands/tail.js +4 -11
  75. package/dist/commands/types.d.ts +2 -0
  76. package/dist/commands.js +2 -0
  77. package/dist/connection/chromeIdentity.d.ts +65 -0
  78. package/dist/connection/chromeIdentity.js +143 -0
  79. package/dist/connection/launcher/profilePreferences.d.ts +47 -0
  80. package/dist/connection/launcher/profilePreferences.js +151 -0
  81. package/dist/connection/launcher.d.ts +21 -2
  82. package/dist/connection/launcher.js +42 -16
  83. package/dist/connection/portReservation.d.ts +14 -4
  84. package/dist/connection/portReservation.js +21 -6
  85. package/dist/connection/startupExit.d.ts +8 -0
  86. package/dist/connection/startupExit.js +15 -6
  87. package/dist/constants.d.ts +6 -2
  88. package/dist/constants.js +9 -2
  89. package/dist/daemon/SessionController.js +23 -7
  90. package/dist/daemon/errors.d.ts +1 -1
  91. package/dist/daemon/errors.js +1 -1
  92. package/dist/daemon/launcher.d.ts +10 -2
  93. package/dist/daemon/launcher.js +8 -7
  94. package/dist/daemon/server/SocketServer.js +1 -2
  95. package/dist/daemon/session/Session.d.ts +20 -0
  96. package/dist/daemon/session/Session.js +80 -9
  97. package/dist/daemon/session/chromeConnection.d.ts +9 -0
  98. package/dist/daemon/session/chromeConnection.js +45 -8
  99. package/dist/daemon/session/commandRegistry.d.ts +14 -1
  100. package/dist/daemon/session/commandRegistry.js +113 -67
  101. package/dist/daemon/session/interactions.d.ts +48 -9
  102. package/dist/daemon/session/interactions.js +46 -9
  103. package/dist/daemon/session/triggeredRequests.d.ts +67 -0
  104. package/dist/daemon/session/triggeredRequests.js +157 -0
  105. package/dist/daemon/session/types.d.ts +5 -1
  106. package/dist/daemon.js +10630 -3601
  107. package/dist/errors/messages.d.ts +456 -24
  108. package/dist/errors/messages.js +862 -67
  109. package/dist/index.js +6915 -3401
  110. package/dist/ipc/client.d.ts +21 -1
  111. package/dist/ipc/client.js +35 -3
  112. package/dist/ipc/protocol/commands.d.ts +145 -5
  113. package/dist/ipc/protocol/commands.js +4 -0
  114. package/dist/ipc/protocol/domTypes.d.ts +291 -7
  115. package/dist/ipc/protocol/inspectTypes.d.ts +388 -0
  116. package/dist/ipc/protocol/inspectTypes.js +10 -0
  117. package/dist/ipc/session/lifecycle.d.ts +8 -1
  118. package/dist/ipc/session/queries.d.ts +5 -1
  119. package/dist/ipc/session/types.d.ts +5 -0
  120. package/dist/ipc/transport/index.d.ts +2 -1
  121. package/dist/ipc/transport/index.js +2 -2
  122. package/dist/runtime/dom/actionEffects.d.ts +185 -0
  123. package/dist/runtime/dom/actionEffects.js +402 -0
  124. package/dist/runtime/dom/actionEffectsScripts.d.ts +90 -0
  125. package/dist/runtime/dom/actionEffectsScripts.js +426 -0
  126. package/dist/runtime/dom/elementGeometry.d.ts +170 -0
  127. package/dist/runtime/dom/elementGeometry.js +553 -0
  128. package/dist/runtime/dom/elementInfo.d.ts +103 -0
  129. package/dist/runtime/dom/elementInfo.js +256 -0
  130. package/dist/runtime/dom/evalHelpers.d.ts +51 -6
  131. package/dist/runtime/dom/evalHelpers.js +136 -26
  132. package/dist/runtime/dom/eventListeners.d.ts +2 -1
  133. package/dist/runtime/dom/eventListeners.js +184 -47
  134. package/dist/runtime/dom/formDiscovery.d.ts +1 -1
  135. package/dist/runtime/dom/formDiscovery.js +116 -16
  136. package/dist/runtime/dom/formFillHelpers/fill.d.ts +9 -0
  137. package/dist/runtime/dom/formFillHelpers/fill.js +178 -14
  138. package/dist/runtime/dom/formFillHelpers/index.d.ts +2 -2
  139. package/dist/runtime/dom/formFillHelpers/index.js +2 -2
  140. package/dist/runtime/dom/formFillHelpers/pressKey.js +14 -3
  141. package/dist/runtime/dom/formFillHelpers/scroll.d.ts +3 -0
  142. package/dist/runtime/dom/formFillHelpers/scroll.js +60 -18
  143. package/dist/runtime/dom/formFillHelpers/shared.d.ts +17 -0
  144. package/dist/runtime/dom/formFillHelpers/shared.js +25 -1
  145. package/dist/runtime/dom/formFillHelpers/stability.d.ts +20 -6
  146. package/dist/runtime/dom/formFillHelpers/stability.js +50 -19
  147. package/dist/runtime/dom/formSubmitHelpers.d.ts +3 -0
  148. package/dist/runtime/dom/formSubmitHelpers.js +89 -15
  149. package/dist/runtime/dom/frameLayout.d.ts +60 -0
  150. package/dist/runtime/dom/frameLayout.js +140 -0
  151. package/dist/runtime/dom/frameOrigin.d.ts +50 -0
  152. package/dist/runtime/dom/frameOrigin.js +62 -0
  153. package/dist/runtime/dom/frameScopedConnection.d.ts +92 -0
  154. package/dist/runtime/dom/frameScopedConnection.js +252 -0
  155. package/dist/runtime/dom/frameSelection.d.ts +12 -1
  156. package/dist/runtime/dom/frameSelection.js +22 -3
  157. package/dist/runtime/dom/frames.d.ts +61 -5
  158. package/dist/runtime/dom/frames.js +329 -75
  159. package/dist/runtime/dom/inspect.d.ts +28 -0
  160. package/dist/runtime/dom/inspect.js +557 -0
  161. package/dist/runtime/dom/inspectAllStyles.d.ts +62 -0
  162. package/dist/runtime/dom/inspectAllStyles.js +385 -0
  163. package/dist/runtime/dom/inspectCascade.d.ts +94 -0
  164. package/dist/runtime/dom/inspectCascade.js +371 -0
  165. package/dist/runtime/dom/inspectCascadeModel.d.ts +39 -0
  166. package/dist/runtime/dom/inspectCascadeModel.js +232 -0
  167. package/dist/runtime/dom/inspectHints.d.ts +62 -0
  168. package/dist/runtime/dom/inspectHints.js +305 -0
  169. package/dist/runtime/dom/inspectLayoutModel.d.ts +87 -0
  170. package/dist/runtime/dom/inspectLayoutModel.js +346 -0
  171. package/dist/runtime/dom/inspectModel.d.ts +74 -0
  172. package/dist/runtime/dom/inspectModel.js +184 -0
  173. package/dist/runtime/dom/inspectPaintModel.d.ts +157 -0
  174. package/dist/runtime/dom/inspectPaintModel.js +461 -0
  175. package/dist/runtime/dom/inspectRules.d.ts +37 -0
  176. package/dist/runtime/dom/inspectRules.js +101 -0
  177. package/dist/runtime/dom/inspectScripts.d.ts +132 -0
  178. package/dist/runtime/dom/inspectScripts.js +263 -0
  179. package/dist/runtime/dom/inspectTree.d.ts +40 -0
  180. package/dist/runtime/dom/inspectTree.js +134 -0
  181. package/dist/runtime/dom/inspectVariables.d.ts +33 -0
  182. package/dist/runtime/dom/inspectVariables.js +94 -0
  183. package/dist/runtime/dom/inspectWhyModel.d.ts +20 -0
  184. package/dist/runtime/dom/inspectWhyModel.js +134 -0
  185. package/dist/runtime/dom/layout.d.ts +71 -0
  186. package/dist/runtime/dom/layout.js +340 -0
  187. package/dist/runtime/dom/listenerPageScripts.d.ts +72 -0
  188. package/dist/runtime/dom/listenerPageScripts.js +365 -0
  189. package/dist/runtime/dom/listenerSummary.d.ts +136 -11
  190. package/dist/runtime/dom/listenerSummary.js +361 -22
  191. package/dist/runtime/dom/pageActivity.d.ts +41 -0
  192. package/dist/runtime/dom/pageActivity.js +123 -0
  193. package/dist/runtime/dom/reactEventHelpers.d.ts +63 -2
  194. package/dist/runtime/dom/reactEventHelpers.js +220 -41
  195. package/dist/runtime/dom/targetNode.d.ts +80 -27
  196. package/dist/runtime/dom/targetNode.js +249 -33
  197. package/dist/runtime/dom/wait.d.ts +25 -0
  198. package/dist/runtime/dom/wait.js +199 -0
  199. package/dist/runtime/dom/waitCondition.d.ts +71 -0
  200. package/dist/runtime/dom/waitCondition.js +75 -0
  201. package/dist/runtime/page/emulation.d.ts +71 -0
  202. package/dist/runtime/page/emulation.js +117 -0
  203. package/dist/runtime/page/loadingState.d.ts +36 -0
  204. package/dist/runtime/page/loadingState.js +86 -0
  205. package/dist/runtime/page/navigation.d.ts +46 -2
  206. package/dist/runtime/page/navigation.js +69 -33
  207. package/dist/session/QueryCacheManager.d.ts +11 -1
  208. package/dist/session/QueryCacheManager.js +25 -3
  209. package/dist/session/chromeOwners.d.ts +34 -0
  210. package/dist/session/chromeOwners.js +51 -0
  211. package/dist/session/cleanup/staleSession.d.ts +11 -1
  212. package/dist/session/cleanup/staleSession.js +17 -6
  213. package/dist/session/cleanup/userCommands.js +2 -4
  214. package/dist/session/metadata.d.ts +5 -1
  215. package/dist/session/metadata.js +2 -1
  216. package/dist/session/paths.d.ts +77 -3
  217. package/dist/session/paths.js +111 -5
  218. package/dist/session/port.d.ts +31 -7
  219. package/dist/session/port.js +50 -43
  220. package/dist/session/portClaims.d.ts +66 -0
  221. package/dist/session/portClaims.js +284 -0
  222. package/dist/session/sessionList.d.ts +58 -0
  223. package/dist/session/sessionList.js +199 -0
  224. package/dist/session/sessionName.d.ts +46 -0
  225. package/dist/session/sessionName.js +97 -0
  226. package/dist/telemetry/a11y.d.ts +18 -3
  227. package/dist/telemetry/a11y.js +170 -29
  228. package/dist/telemetry/console.d.ts +1 -0
  229. package/dist/telemetry/console.js +100 -5
  230. package/dist/telemetry/network.js +3 -1
  231. package/dist/telemetry/requestKinds.d.ts +32 -0
  232. package/dist/telemetry/requestKinds.js +61 -0
  233. package/dist/telemetry/requestState.d.ts +31 -0
  234. package/dist/telemetry/requestState.js +38 -0
  235. package/dist/types.d.ts +112 -3
  236. package/dist/ui/formatters/a11y.js +3 -0
  237. package/dist/ui/formatters/console/chronological.d.ts +8 -0
  238. package/dist/ui/formatters/console/chronological.js +17 -4
  239. package/dist/ui/formatters/console/json.js +3 -4
  240. package/dist/ui/formatters/console/shared.d.ts +12 -0
  241. package/dist/ui/formatters/console.d.ts +2 -2
  242. package/dist/ui/formatters/console.js +1 -1
  243. package/dist/ui/formatters/details.d.ts +8 -0
  244. package/dist/ui/formatters/details.js +61 -4
  245. package/dist/ui/formatters/dom.d.ts +27 -14
  246. package/dist/ui/formatters/dom.js +88 -59
  247. package/dist/ui/formatters/form.js +29 -18
  248. package/dist/ui/formatters/inspect.d.ts +39 -0
  249. package/dist/ui/formatters/inspect.js +596 -0
  250. package/dist/ui/formatters/keyAttributes.d.ts +19 -0
  251. package/dist/ui/formatters/keyAttributes.js +84 -0
  252. package/dist/ui/formatters/layout.d.ts +31 -0
  253. package/dist/ui/formatters/layout.js +53 -0
  254. package/dist/ui/formatters/listeners.d.ts +3 -2
  255. package/dist/ui/formatters/listeners.js +73 -9
  256. package/dist/ui/formatters/networkHeaders.d.ts +13 -0
  257. package/dist/ui/formatters/networkHeaders.js +36 -3
  258. package/dist/ui/formatters/networkList.d.ts +29 -1
  259. package/dist/ui/formatters/networkList.js +86 -20
  260. package/dist/ui/formatters/preview.js +2 -1
  261. package/dist/ui/formatters/requestStatus.d.ts +1 -17
  262. package/dist/ui/formatters/requestStatus.js +2 -30
  263. package/dist/ui/formatters/sessions.d.ts +12 -0
  264. package/dist/ui/formatters/sessions.js +40 -0
  265. package/dist/ui/formatters/status.d.ts +21 -2
  266. package/dist/ui/formatters/status.js +47 -10
  267. package/dist/ui/formatters/triggeredRequests.d.ts +36 -0
  268. package/dist/ui/formatters/triggeredRequests.js +65 -0
  269. package/dist/ui/formatting.d.ts +19 -0
  270. package/dist/ui/formatting.js +31 -36
  271. package/dist/ui/messages/chrome.d.ts +9 -0
  272. package/dist/ui/messages/chrome.js +17 -5
  273. package/dist/ui/messages/commands.d.ts +504 -14
  274. package/dist/ui/messages/commands.js +835 -21
  275. package/dist/ui/messages/consoleMessages.d.ts +10 -0
  276. package/dist/ui/messages/consoleMessages.js +17 -0
  277. package/dist/ui/messages/hints.js +2 -1
  278. package/dist/ui/messages/networkMessages.d.ts +14 -0
  279. package/dist/ui/messages/networkMessages.js +18 -0
  280. package/dist/ui/messages/preview.js +5 -4
  281. package/dist/ui/messages/session.d.ts +30 -21
  282. package/dist/ui/messages/session.js +48 -26
  283. package/dist/ui/messages/sessionCommand.d.ts +43 -0
  284. package/dist/ui/messages/sessionCommand.js +52 -0
  285. package/dist/utils/async.d.ts +17 -0
  286. package/dist/utils/async.js +36 -0
  287. package/dist/utils/color.d.ts +84 -0
  288. package/dist/utils/color.js +376 -0
  289. package/dist/utils/cssValues.d.ts +109 -0
  290. package/dist/utils/cssValues.js +236 -0
  291. package/dist/utils/http.d.ts +22 -1
  292. package/dist/utils/http.js +28 -9
  293. package/dist/utils/selectorFilters.d.ts +48 -8
  294. package/dist/utils/selectorFilters.js +296 -53
  295. package/dist/utils/shellDetection.d.ts +8 -2
  296. package/dist/utils/shellDetection.js +120 -33
  297. package/dist/utils/suggestions.d.ts +26 -0
  298. package/dist/utils/suggestions.js +73 -0
  299. package/dist/utils/taskMappings.js +10 -0
  300. package/dist/utils/url.d.ts +12 -2
  301. package/dist/utils/url.js +69 -7
  302. package/package.json +1 -1
  303. package/dist/ui/formatters/sessionFormatters.d.ts +0 -58
  304. package/dist/ui/formatters/sessionFormatters.js +0 -121
@@ -0,0 +1,15 @@
1
+ /**
2
+ * `bdg dom inspect <selector|index>` - what one element looks like, without a
3
+ * screenshot: its box, layout (and its place in the parent), typography with
4
+ * the rendered font and contrast, fills, borders, effects, CSS state,
5
+ * pseudo-elements and a compact child tree, as grouped lines (`--json`:
6
+ * Figma-aligned fields).
7
+ */
8
+ import { type Command } from 'commander';
9
+ /**
10
+ * Register `bdg dom inspect`.
11
+ *
12
+ * @param dom - The `dom` command group
13
+ */
14
+ export declare function registerInspectCommand(dom: Command): void;
15
+ //# sourceMappingURL=inspect.d.ts.map
@@ -0,0 +1,82 @@
1
+ /**
2
+ * `bdg dom inspect <selector|index>` - what one element looks like, without a
3
+ * screenshot: its box, layout (and its place in the parent), typography with
4
+ * the rendered font and contrast, fills, borders, effects, CSS state,
5
+ * pseudo-elements and a compact child tree, as grouped lines (`--json`:
6
+ * Figma-aligned fields).
7
+ */
8
+ import { Option } from 'commander';
9
+ import { runElementCommand } from './helpers/runElementCommand.js';
10
+ import { runCommand } from '../shared/CommandRunner.js';
11
+ import { jsonOption, SELECTOR_OR_INDEX_ARGUMENT } from '../shared/commonOptions.js';
12
+ import { cssPropertiesOption, integerOption } from '../shared/validation.js';
13
+ import { domInspect } from '../../ipc/client.js';
14
+ import { DEFAULT_TREE_DEPTH, DEFAULT_TREE_LIMIT } from '../../runtime/dom/inspectTree.js';
15
+ import { formatInspect } from '../../ui/formatters/inspect.js';
16
+ import { INSPECT_OUTPUT_LEGEND } from '../../ui/messages/commands.js';
17
+ import { filterDefined } from '../../utils/objects.js';
18
+ /**
19
+ * Register `bdg dom inspect`.
20
+ *
21
+ * @param dom - The `dom` command group
22
+ */
23
+ export function registerInspectCommand(dom) {
24
+ dom
25
+ .command('inspect')
26
+ .description('What one element looks like without a screenshot: box, layout, font (rendered, contrast), colors, borders, effects, pseudo-elements and child tree')
27
+ .argument('<selectorOrIndex>', SELECTOR_OR_INDEX_ARGUMENT)
28
+ .option('--index <n>', 'Which match to inspect (0-based; default: the first rendered one)', integerOption(0))
29
+ .option('--tree <depth>', `Child tree depth (default ${DEFAULT_TREE_DEPTH}; 0 for none)`, integerOption(0, 10))
30
+ .option('--tree-limit <n>', `Child tree rows at most (default ${DEFAULT_TREE_LIMIT})`, integerOption(1, 500))
31
+ .addOption(new Option('--all', 'Every computed property that is not its default, collapsed into shorthands, instead of the groups').conflicts('props'))
32
+ .addHelpText('after', INSPECT_OUTPUT_LEGEND)
33
+ .option('--props <names>', "Only these properties, computed and normalized (comma-separated, e.g. padding,color,--brand; '--*' or '--bs-btn-*' lists custom properties)", cssPropertiesOption)
34
+ .addOption(new Option('--rules', 'Also show which CSS rule sets each shown property (selector, file:line, what it overrides); with --props, those properties').conflicts('all'))
35
+ .addOption(new Option('--why <property>', 'Every declaration of one property: the one that applies and those it overrides (e.g. --why color)')
36
+ .conflicts('all')
37
+ .argParser(propertyOption))
38
+ .option('--no-hints', 'Skip the check for declarations that have no effect')
39
+ .addOption(jsonOption())
40
+ .action(async (selectorOrIndex, options) => {
41
+ await runCommand(() => inspectTarget(selectorOrIndex, options), options, formatInspect);
42
+ });
43
+ }
44
+ /**
45
+ * Parse `--why`: a property name, lowercased (custom properties as given).
46
+ *
47
+ * @param value - Property name
48
+ * @returns Name
49
+ */
50
+ function propertyOption(value) {
51
+ return value.startsWith('--') ? value.trim() : value.trim().toLowerCase();
52
+ }
53
+ /**
54
+ * Resolve the target and ask the daemon to inspect it.
55
+ *
56
+ * @param selectorOrIndex - CSS selector or cached query index
57
+ * @param options - Command options
58
+ * @returns Command result
59
+ */
60
+ async function inspectTarget(selectorOrIndex, options) {
61
+ return runElementCommand({
62
+ selectorOrIndex,
63
+ index: options.index,
64
+ buildRequest: (target) => ({
65
+ ...target,
66
+ ...filterDefined({
67
+ tree: options.tree,
68
+ treeLimit: options.treeLimit,
69
+ all: options.all,
70
+ props: options.props,
71
+ rules: options.rules,
72
+ why: options.why,
73
+ ...(options.hints === false && { hints: false }),
74
+ }),
75
+ }),
76
+ call: domInspect,
77
+ command: 'inspect',
78
+ action: 'inspect the element',
79
+ failureSuggestion: 'Verify the selector matches an element: bdg dom query "<selector>"',
80
+ });
81
+ }
82
+ //# sourceMappingURL=inspect.js.map
@@ -0,0 +1,14 @@
1
+ /**
2
+ * `bdg dom layout <selector|index>` - where elements are on the page and
3
+ * whether a user can see them, without a screenshot: page and viewport
4
+ * coordinates, size, viewport position (visible, partly, above/below the
5
+ * fold, hidden), what covers them and the styles that decide how they show.
6
+ */
7
+ import type { Command } from 'commander';
8
+ /**
9
+ * Register `bdg dom layout`.
10
+ *
11
+ * @param dom - The `dom` command group
12
+ */
13
+ export declare function registerLayoutCommand(dom: Command): void;
14
+ //# sourceMappingURL=layout.d.ts.map
@@ -0,0 +1,54 @@
1
+ /**
2
+ * `bdg dom layout <selector|index>` - where elements are on the page and
3
+ * whether a user can see them, without a screenshot: page and viewport
4
+ * coordinates, size, viewport position (visible, partly, above/below the
5
+ * fold, hidden), what covers them and the styles that decide how they show.
6
+ */
7
+ import { DomElementResolver } from './DomElementResolver.js';
8
+ import { runElementCommand } from './helpers/runElementCommand.js';
9
+ import { runCommand } from '../shared/CommandRunner.js';
10
+ import { jsonOption, SELECTOR_OR_INDEX_ARGUMENT } from '../shared/commonOptions.js';
11
+ import { integerOption } from '../shared/validation.js';
12
+ import { domLayout } from '../../ipc/client.js';
13
+ import { formatLayout } from '../../ui/formatters/layout.js';
14
+ /**
15
+ * Register `bdg dom layout`.
16
+ *
17
+ * @param dom - The `dom` command group
18
+ */
19
+ export function registerLayoutCommand(dom) {
20
+ dom
21
+ .command('layout')
22
+ .description('Positions, sizes and visibility of elements (above/below the fold, hidden, covered) without a screenshot')
23
+ .argument('<selectorOrIndex>', SELECTOR_OR_INDEX_ARGUMENT)
24
+ .option('--index <n>', 'Only this match of the selector (0-based)', integerOption(0))
25
+ .addOption(jsonOption())
26
+ .action(async (selectorOrIndex, options) => {
27
+ await runCommand(() => measureLayout(selectorOrIndex, options), options, formatLayout);
28
+ });
29
+ }
30
+ /**
31
+ * Resolve the target and ask the daemon to measure it.
32
+ *
33
+ * @param selectorOrIndex - CSS selector or cached query index
34
+ * @param options - Command options
35
+ * @returns Command result; an index argument is reported as the element's `index`
36
+ */
37
+ async function measureLayout(selectorOrIndex, options) {
38
+ const result = await runElementCommand({
39
+ selectorOrIndex,
40
+ index: options.index,
41
+ buildRequest: (target) => target,
42
+ call: domLayout,
43
+ command: 'layout',
44
+ action: 'measure the layout',
45
+ failureSuggestion: 'Verify the selector matches an element: bdg dom query "<selector>"',
46
+ });
47
+ if (!result.data || !DomElementResolver.getInstance().isNumericIndex(selectorOrIndex)) {
48
+ return result;
49
+ }
50
+ const index = Number(selectorOrIndex);
51
+ const elements = result.data.elements.map((element) => ({ ...element, index }));
52
+ return { ...result, data: { ...result.data, elements } };
53
+ }
54
+ //# sourceMappingURL=layout.js.map
@@ -4,7 +4,11 @@
4
4
  *
5
5
  * The daemon collects them with `DOMDebugger.getEventListeners`; listeners on
6
6
  * ancestors matter because frameworks (React, jQuery) attach their handlers
7
- * to a root container or the document and dispatch from there.
7
+ * to a root container or the document and dispatch from there. jQuery's
8
+ * dispatcher is replaced by the jQuery handlers it runs for the element,
9
+ * React's `on…` props of the element and its ancestors are listed, and
10
+ * framework roots (React's root container) are summarised per node unless
11
+ * `--all` is given.
8
12
  */
9
13
  import type { Command } from 'commander';
10
14
  /**
@@ -4,12 +4,16 @@
4
4
  *
5
5
  * The daemon collects them with `DOMDebugger.getEventListeners`; listeners on
6
6
  * ancestors matter because frameworks (React, jQuery) attach their handlers
7
- * to a root container or the document and dispatch from there.
7
+ * to a root container or the document and dispatch from there. jQuery's
8
+ * dispatcher is replaced by the jQuery handlers it runs for the element,
9
+ * React's `on…` props of the element and its ancestors are listed, and
10
+ * framework roots (React's root container) are summarised per node unless
11
+ * `--all` is given.
8
12
  */
9
13
  import { DomElementResolver } from './DomElementResolver.js';
10
14
  import { runElementCommand } from './helpers/runElementCommand.js';
11
15
  import { runCommand } from '../shared/CommandRunner.js';
12
- import { jsonOption } from '../shared/commonOptions.js';
16
+ import { jsonOption, SELECTOR_OR_INDEX_ARGUMENT } from '../shared/commonOptions.js';
13
17
  import { eventTypesOption, integerOption } from '../shared/validation.js';
14
18
  import { domListeners } from '../../ipc/client.js';
15
19
  import { formatListeners } from '../../ui/formatters/listeners.js';
@@ -22,9 +26,10 @@ export function registerListenersCommand(dom) {
22
26
  dom
23
27
  .command('listeners')
24
28
  .description('List event listeners that run for an element (incl. delegated ones on ancestors)')
25
- .argument('<selectorOrIndex>', 'CSS selector or numeric index from query results (0-based)')
29
+ .argument('<selectorOrIndex>', SELECTOR_OR_INDEX_ARGUMENT)
26
30
  .option('--index <n>', 'Element index if selector matches multiple (0-based)', integerOption(0))
27
- .option('--type <types>', 'Only these event types (comma-separated, e.g. click,keydown)', eventTypesOption)
31
+ .option('--type <types>', 'Only these event types (comma-separated, e.g. click,keydown; repeatable)', eventTypesOption)
32
+ .option('--all', 'List every listener of framework roots (React) instead of one line per node')
28
33
  .addOption(jsonOption())
29
34
  .action(async (selectorOrIndex, options) => {
30
35
  await runCommand(() => listElementListeners(selectorOrIndex, options), options, (data) => formatListeners(data, options.type));
@@ -41,8 +46,13 @@ async function listElementListeners(selectorOrIndex, options) {
41
46
  const result = await runElementCommand({
42
47
  selectorOrIndex,
43
48
  index: options.index,
44
- buildRequest: (target) => ({ ...target, ...(options.type && { types: options.type }) }),
49
+ buildRequest: (target) => ({
50
+ ...target,
51
+ ...(options.type && { types: options.type }),
52
+ ...(options.all && { all: true }),
53
+ }),
45
54
  call: domListeners,
55
+ command: 'listeners',
46
56
  action: 'list event listeners',
47
57
  failureSuggestion: 'Verify the selector matches an element: bdg dom query "<selector>"',
48
58
  });
@@ -1,9 +1,8 @@
1
1
  /**
2
2
  * `bdg dom query` — find elements by CSS selector and populate the query cache.
3
3
  */
4
- import { queryDOMElements } from './helpers/index.js';
4
+ import { noMatchesError, queryDOMElements } from './helpers/index.js';
5
5
  import { runCommand } from '../shared/CommandRunner.js';
6
- import { noNodesFoundError } from '../../errors/messages.js';
7
6
  import { QueryCacheManager } from '../../session/QueryCacheManager.js';
8
7
  import { formatDomQuery } from '../../ui/formatters/dom.js';
9
8
  import { EXIT_CODES } from '../../utils/exitCodes.js';
@@ -21,7 +20,7 @@ export async function handleDomQuery(selector, options) {
21
20
  const cache = QueryCacheManager.getInstance();
22
21
  if (result.count === 0) {
23
22
  await cache.clear();
24
- const err = noNodesFoundError(selector);
23
+ const err = await noMatchesError(selector);
25
24
  return {
26
25
  success: false,
27
26
  error: err.message,
@@ -13,9 +13,19 @@ import type { DomScreenshotCommandOptions } from '../shared/optionTypes.js';
13
13
  */
14
14
  export declare function resolveImageFormat(outputPath: string, requested?: 'png' | 'jpeg'): 'png' | 'jpeg';
15
15
  /**
16
- * Handle `bdg dom screenshot <path>`.
16
+ * Fold the optional positional target (`bdg dom screenshot out.png "#sel"`,
17
+ * or an index from a query) into `--selector` / `--index`.
18
+ *
19
+ * @param target - Positional selector or index, if given
20
+ * @param options - Command options
21
+ * @returns Options with the target as `selector` or `index`
22
+ * @throws CommandError (81) when the option names a different element
23
+ */
24
+ export declare function withPositionalTarget(target: string | undefined, options: DomScreenshotCommandOptions): DomScreenshotCommandOptions;
25
+ /**
26
+ * Handle `bdg dom screenshot <path> [selector|index]`.
17
27
  *
18
28
  * Dispatches to page, element, or sequence capture based on flags.
19
29
  */
20
- export declare function handleDomScreenshot(outputPath: string, options: DomScreenshotCommandOptions): Promise<void>;
30
+ export declare function handleDomScreenshot(outputPath: string, target: string | undefined, commandOptions: DomScreenshotCommandOptions): Promise<void>;
21
31
  //# sourceMappingURL=screenshot.d.ts.map
@@ -8,7 +8,7 @@ import { runCommand } from '../shared/CommandRunner.js';
8
8
  import { assertFilePath, outputPathError } from '../shared/outputFile.js';
9
9
  import { positiveIntRule } from '../shared/validation.js';
10
10
  import { CommandError } from '../../errors/index.js';
11
- import { conflictingOptionsMessage, genericError } from '../../errors/messages.js';
11
+ import { conflictingOptionsMessage, conflictingTargetError, genericError, } from '../../errors/messages.js';
12
12
  import { missingArgumentError } from '../../errors/messages.js';
13
13
  import { OutputBuilder, buildSuccessResponse } from '../../ui/OutputBuilder.js';
14
14
  import { formatDomScreenshot } from '../../ui/formatters/dom.js';
@@ -90,6 +90,7 @@ function addElementInfo(result, options) {
90
90
  ...(options.selector !== undefined && { selector: options.selector }),
91
91
  ...(options.index !== undefined && { index: options.index }),
92
92
  bounds,
93
+ ...(result.element?.captured && { captured: result.element.captured }),
93
94
  },
94
95
  };
95
96
  }
@@ -227,11 +228,34 @@ function assertScreenshotOptions(outputPath, options) {
227
228
  throw new CommandError(message, {}, EXIT_CODES.INVALID_ARGUMENTS);
228
229
  }
229
230
  /**
230
- * Handle `bdg dom screenshot <path>`.
231
+ * Fold the optional positional target (`bdg dom screenshot out.png "#sel"`,
232
+ * or an index from a query) into `--selector` / `--index`.
233
+ *
234
+ * @param target - Positional selector or index, if given
235
+ * @param options - Command options
236
+ * @returns Options with the target as `selector` or `index`
237
+ * @throws CommandError (81) when the option names a different element
238
+ */
239
+ export function withPositionalTarget(target, options) {
240
+ if (target === undefined)
241
+ return options;
242
+ const isIndex = /^\d+$/.test(target);
243
+ const key = isIndex ? 'index' : 'selector';
244
+ const value = isIndex ? Number(target) : target;
245
+ const given = options[key];
246
+ if (given !== undefined && given !== value) {
247
+ const err = conflictingTargetError(`--${key} ${String(given)}`, target);
248
+ throw new CommandError(err.message, { suggestion: err.suggestion }, EXIT_CODES.INVALID_ARGUMENTS);
249
+ }
250
+ return { ...options, [key]: value };
251
+ }
252
+ /**
253
+ * Handle `bdg dom screenshot <path> [selector|index]`.
231
254
  *
232
255
  * Dispatches to page, element, or sequence capture based on flags.
233
256
  */
234
- export async function handleDomScreenshot(outputPath, options) {
257
+ export async function handleDomScreenshot(outputPath, target, commandOptions) {
258
+ const options = withPositionalTarget(target, commandOptions);
235
259
  assertScreenshotOptions(outputPath, options);
236
260
  if (options.follow) {
237
261
  await handleSequenceCapture(outputPath, options);
@@ -5,7 +5,7 @@
5
5
  * their surrounding DOM context and to fall back gracefully when only one
6
6
  * of the two data sources is available.
7
7
  */
8
- import { type DomContext } from './helpers/index.js';
8
+ import type { DomContext } from './helpers/index.js';
9
9
  import type { A11yNode } from '../../types.js';
10
10
  /**
11
11
  * Accessibility node paired with its surrounding DOM context for display.
@@ -17,8 +17,14 @@ export interface SemanticNodeWithContext {
17
17
  /**
18
18
  * Format a semantic node together with DOM context for human-readable output.
19
19
  *
20
+ * The role line names the element's key attributes (an image's file name, a
21
+ * link's href, a field's type and name), like `dom query` does, and is
22
+ * followed by up to 500 characters of the element's text
23
+ * (all of it with `dom get --full`) when it is longer than the one-line
24
+ * preview, or, for an element without text or name, what it holds.
25
+ *
20
26
  * @param data - Accessibility node and optional DOM context
21
- * @returns One-line formatted string
27
+ * @returns Role line, plus a text line for elements with longer text
22
28
  */
23
29
  export declare function formatSemanticNodeWithContext(data: SemanticNodeWithContext): string;
24
30
  /**
@@ -31,14 +37,14 @@ export declare function formatSemanticNodeWithContext(data: SemanticNodeWithCont
31
37
  */
32
38
  export declare function resolveNodeWithFallback(a11yNode: A11yNode | null, domContext: DomContext | null, nodeId: number | undefined): A11yNode | null;
33
39
  /**
34
- * Look up a single element by selector to produce its nodeId and DOM context.
40
+ * The accessibility node with its value masked when the element holds a
41
+ * secret (`domContext.sensitive`): Chrome reports a password field's value
42
+ * as one bullet per character, and a field switched to text by a "show
43
+ * password" button in clear.
35
44
  *
36
- * Used by `dom get` (semantic mode) when the accessibility tree has no node
37
- * for the selector — the selector-based DOM context allows us to synthesize
38
- * one.
45
+ * @param node - Accessibility node
46
+ * @param domContext - DOM context of the same element
47
+ * @returns The node, with {@link MASKED_VALUE} as its value for a secret
39
48
  */
40
- export declare function queryDomContextBySelector(selector: string): Promise<{
41
- nodeId: number | undefined;
42
- domContext: DomContext | null;
43
- }>;
49
+ export declare function withSecretMasked(node: A11yNode, domContext: DomContext | null): A11yNode;
44
50
  //# sourceMappingURL=semanticUtils.d.ts.map
@@ -5,8 +5,11 @@
5
5
  * their surrounding DOM context and to fall back gracefully when only one
6
6
  * of the two data sources is available.
7
7
  */
8
- import { getDomContext, resolveBackendNodeIds, } from './helpers/index.js';
8
+ import { MASKED_VALUE } from '../../runtime/dom/elementInfo.js';
9
9
  import { synthesizeA11yNode } from '../../telemetry/roleInference.js';
10
+ import { keyAttributeItems } from '../../ui/formatters/keyAttributes.js';
11
+ import { joinLines } from '../../ui/formatting.js';
12
+ import { elementTextLine, emptyElementLine } from '../../ui/messages/commands.js';
10
13
  function capitalize(str) {
11
14
  return str.charAt(0).toUpperCase() + str.slice(1);
12
15
  }
@@ -29,11 +32,32 @@ function buildContextText(node, domContext) {
29
32
  const classPart = domContext.classes && domContext.classes.length > 0
30
33
  ? `.${domContext.classes.slice(0, 3).join('.')}`
31
34
  : '';
32
- const previewPart = domContext.preview ? ` "${domContext.preview}"` : '';
35
+ const previewPart = domContext.preview && !domContext.text ? ` "${domContext.preview}"` : '';
33
36
  return ` ${tagPart}${classPart}>${previewPart}`;
34
37
  }
35
38
  return '';
36
39
  }
40
+ /**
41
+ * Key attributes of the element (src, href, a field's type and name, ...),
42
+ * leaving out what the role line already shows: values equal to the
43
+ * accessible name (an image's alt, a field's placeholder) and the value
44
+ * when the accessibility node has one.
45
+ *
46
+ * @param node - Accessibility node
47
+ * @param domContext - DOM context with the key attributes
48
+ * @returns ` src="…/logo.png"`-style text, or empty
49
+ */
50
+ function buildKeyAttributesText(node, domContext) {
51
+ if (!domContext?.attributes)
52
+ return '';
53
+ const shown = Object.entries(domContext.attributes)
54
+ .filter(([, value]) => Boolean(node.name) && value === node.name)
55
+ .map(([name]) => name);
56
+ if (node.value !== undefined && node.value !== '')
57
+ shown.push('value');
58
+ const items = keyAttributeItems(domContext.tag, domContext.attributes, new Set(shown));
59
+ return items.length > 0 ? ` ${items.join(' ')}` : '';
60
+ }
37
61
  function buildPropertiesText(node) {
38
62
  const props = [];
39
63
  if (node.value !== undefined && node.value !== '')
@@ -58,16 +82,29 @@ function buildPropertiesText(node) {
58
82
  /**
59
83
  * Format a semantic node together with DOM context for human-readable output.
60
84
  *
85
+ * The role line names the element's key attributes (an image's file name, a
86
+ * link's href, a field's type and name), like `dom query` does, and is
87
+ * followed by up to 500 characters of the element's text
88
+ * (all of it with `dom get --full`) when it is longer than the one-line
89
+ * preview, or, for an element without text or name, what it holds.
90
+ *
61
91
  * @param data - Accessibility node and optional DOM context
62
- * @returns One-line formatted string
92
+ * @returns Role line, plus a text line for elements with longer text
63
93
  */
64
94
  export function formatSemanticNodeWithContext(data) {
65
95
  const { node, domContext } = data;
66
96
  const roleText = buildRoleText(node);
67
97
  const contextText = buildContextText(node, domContext);
98
+ const keysText = buildKeyAttributesText(node, domContext);
68
99
  const propsText = buildPropertiesText(node);
69
100
  const inferredText = node.inferred ? ' (inferred from DOM)' : '';
70
- return `${roleText}${contextText}${propsText}${inferredText}`;
101
+ const line = `${roleText}${contextText}${keysText}${propsText}${inferredText}`;
102
+ if (domContext?.text)
103
+ return joinLines(line, elementTextLine(domContext.text));
104
+ if (domContext?.childCount !== undefined && !node.name) {
105
+ return joinLines(line, emptyElementLine(domContext.children ?? [], domContext.childCount));
106
+ }
107
+ return line;
71
108
  }
72
109
  /**
73
110
  * Resolve an a11y node, falling back to a DOM-synthesized one when only
@@ -79,24 +116,24 @@ export function formatSemanticNodeWithContext(data) {
79
116
  */
80
117
  export function resolveNodeWithFallback(a11yNode, domContext, nodeId) {
81
118
  if (a11yNode)
82
- return a11yNode;
119
+ return withSecretMasked(a11yNode, domContext);
83
120
  if (domContext && nodeId)
84
121
  return synthesizeA11yNode(domContext, nodeId);
85
122
  return null;
86
123
  }
87
124
  /**
88
- * Look up a single element by selector to produce its nodeId and DOM context.
125
+ * The accessibility node with its value masked when the element holds a
126
+ * secret (`domContext.sensitive`): Chrome reports a password field's value
127
+ * as one bullet per character, and a field switched to text by a "show
128
+ * password" button in clear.
89
129
  *
90
- * Used by `dom get` (semantic mode) when the accessibility tree has no node
91
- * for the selector — the selector-based DOM context allows us to synthesize
92
- * one.
130
+ * @param node - Accessibility node
131
+ * @param domContext - DOM context of the same element
132
+ * @returns The node, with {@link MASKED_VALUE} as its value for a secret
93
133
  */
94
- export async function queryDomContextBySelector(selector) {
95
- const [backendNodeId] = await resolveBackendNodeIds([selector]);
96
- if (backendNodeId === undefined) {
97
- return { nodeId: undefined, domContext: null };
98
- }
99
- const domContext = await getDomContext({ backendNodeId });
100
- return { nodeId: backendNodeId, domContext };
134
+ export function withSecretMasked(node, domContext) {
135
+ if (!domContext?.sensitive || !node.value)
136
+ return node;
137
+ return { ...node, value: MASKED_VALUE };
101
138
  }
102
139
  //# sourceMappingURL=semanticUtils.js.map
@@ -0,0 +1,13 @@
1
+ /**
2
+ * `bdg dom wait [selector]` - wait until elements appear, become visible,
3
+ * contain a text or are gone, and/or the page has loaded, instead of
4
+ * polling with `sleep` and `dom eval`.
5
+ */
6
+ import type { Command } from 'commander';
7
+ /**
8
+ * Register `bdg dom wait`.
9
+ *
10
+ * @param dom - The `dom` command group
11
+ */
12
+ export declare function registerWaitCommand(dom: Command): void;
13
+ //# sourceMappingURL=wait.d.ts.map
@@ -0,0 +1,83 @@
1
+ /**
2
+ * `bdg dom wait [selector]` - wait until elements appear, become visible,
3
+ * contain a text or are gone, and/or the page has loaded, instead of
4
+ * polling with `sleep` and `dom eval`.
5
+ */
6
+ import { runCommand } from '../shared/CommandRunner.js';
7
+ import { jsonOption } from '../shared/commonOptions.js';
8
+ import { integerOption } from '../shared/validation.js';
9
+ import { waitTargetRequiredError } from '../../errors/messages.js';
10
+ import { domWait } from '../../ipc/client.js';
11
+ import { WAIT_HELP_EXAMPLES, waitMetMessage } from '../../ui/messages/commands.js';
12
+ import { EXIT_CODES } from '../../utils/exitCodes.js';
13
+ import { filterDefined } from '../../utils/objects.js';
14
+ /** Default --timeout */
15
+ const DEFAULT_WAIT_TIMEOUT_MS = 10_000;
16
+ /** Longest --timeout (10 minutes) */
17
+ const MAX_WAIT_TIMEOUT_MS = 600_000;
18
+ /**
19
+ * Register `bdg dom wait`.
20
+ *
21
+ * @param dom - The `dom` command group
22
+ */
23
+ export function registerWaitCommand(dom) {
24
+ dom
25
+ .command('wait')
26
+ .description('Wait until elements appear, become visible, contain a text or are gone (or the page loads)')
27
+ .argument('[selector]', 'CSS selector (:has-text, :visible allowed; shadow DOM and same-origin iframes searched); optional with --load')
28
+ .option('--text <text>', 'A match must contain this text (case-insensitive)')
29
+ .option('--visible', 'Only count visible matches')
30
+ .option('--gone', 'Wait until no element matches (none visible, with --visible)')
31
+ .option('--load', 'Also wait for the page to finish loading (document.readyState complete)')
32
+ .option('--timeout <ms>', 'Give up after this many milliseconds (exit 102)', integerOption(1, MAX_WAIT_TIMEOUT_MS), DEFAULT_WAIT_TIMEOUT_MS)
33
+ .addOption(jsonOption())
34
+ .addHelpText('after', WAIT_HELP_EXAMPLES)
35
+ .action(async (selector, options) => {
36
+ await runCommand(() => waitFor(selector, options), options, formatWait);
37
+ });
38
+ }
39
+ /**
40
+ * Validate the options and ask the daemon to wait.
41
+ *
42
+ * @param selector - Selector, if given
43
+ * @param options - Command options
44
+ * @returns Command result
45
+ */
46
+ async function waitFor(selector, options) {
47
+ const needsSelector = options.text !== undefined || options.gone === true || !options.load;
48
+ if (selector === undefined && needsSelector) {
49
+ const err = waitTargetRequiredError();
50
+ return {
51
+ success: false,
52
+ error: err.message,
53
+ exitCode: EXIT_CODES.INVALID_ARGUMENTS,
54
+ errorContext: { suggestion: err.suggestion },
55
+ };
56
+ }
57
+ const response = await domWait({
58
+ ...filterDefined({ selector, text: options.text }),
59
+ ...(options.gone && { gone: true }),
60
+ ...(options.visible && { visible: true }),
61
+ ...(options.load && { load: true }),
62
+ timeout: options.timeout,
63
+ });
64
+ if (response.status === 'error' || !response.data) {
65
+ return {
66
+ success: false,
67
+ error: response.error ?? 'Failed to wait',
68
+ exitCode: response.exitCode ?? EXIT_CODES.CDP_CONNECTION_FAILURE,
69
+ ...(response.suggestion && { errorContext: { suggestion: response.suggestion } }),
70
+ };
71
+ }
72
+ return { success: true, data: response.data };
73
+ }
74
+ /**
75
+ * One line for human output.
76
+ *
77
+ * @param data - What the page showed when the condition was met
78
+ * @returns e.g. `✓ #finish visible after 5.1s`
79
+ */
80
+ function formatWait(data) {
81
+ return waitMetMessage(data, data.elapsedMs);
82
+ }
83
+ //# sourceMappingURL=wait.js.map
@@ -97,8 +97,8 @@ function convertCommand(command) {
97
97
  function generateRuntimeState() {
98
98
  const sessionActive = readLiveDaemonPid() !== null;
99
99
  const availableCommands = sessionActive
100
- ? ['peek', 'tail', 'details', 'dom', 'network', 'console', 'cdp', 'status', 'stop']
101
- : ['bdg <url>', 'cleanup', '--help', '--version'];
100
+ ? ['peek', 'tail', 'details', 'dom', 'network', 'console', 'cdp', 'status', 'sessions', 'stop']
101
+ : ['bdg <url>', 'sessions', 'cleanup', '--help', '--version'];
102
102
  return {
103
103
  sessionActive,
104
104
  daemonRunning: sessionActive,