tabwright 1.0.0 → 1.0.1

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 (562) hide show
  1. package/dist/aria-snapshot.d.ts +0 -1
  2. package/dist/aria-snapshot.js +9 -1
  3. package/dist/assets/cursors/screen-studio/pointer-macos-tahoe-data-url.d.ts +0 -1
  4. package/dist/assets/cursors/screen-studio/pointer-macos-tahoe-data-url.js +0 -1
  5. package/dist/bippy.js +1 -1
  6. package/dist/browser-config.d.ts +0 -1
  7. package/dist/browser-config.js +0 -1
  8. package/dist/browser-install.d.ts +0 -1
  9. package/dist/browser-install.js +0 -1
  10. package/dist/browser-launch.d.ts +0 -1
  11. package/dist/browser-launch.js +0 -1
  12. package/dist/builtin-capabilities.d.ts +0 -1
  13. package/dist/builtin-capabilities.js +0 -1
  14. package/dist/capability-agent-skill.d.ts +0 -1
  15. package/dist/capability-agent-skill.js +0 -1
  16. package/dist/capability-auth-state.d.ts +0 -1
  17. package/dist/capability-auth-state.js +0 -1
  18. package/dist/capability-auth.d.ts +0 -1
  19. package/dist/capability-auth.js +0 -1
  20. package/dist/capability-options.d.ts +0 -1
  21. package/dist/capability-options.js +0 -1
  22. package/dist/capability-package.d.ts +0 -1
  23. package/dist/capability-package.js +0 -1
  24. package/dist/capability-registry.d.ts +0 -1
  25. package/dist/capability-registry.js +0 -1
  26. package/dist/capability-runner.d.ts +0 -1
  27. package/dist/capability-runner.js +0 -1
  28. package/dist/capability-studio.d.ts +0 -1
  29. package/dist/capability-studio.js +0 -1
  30. package/dist/cdp-log.d.ts +0 -1
  31. package/dist/cdp-log.js +0 -1
  32. package/dist/cdp-relay.d.ts +0 -1
  33. package/dist/cdp-relay.js +0 -1
  34. package/dist/cdp-session.d.ts +0 -1
  35. package/dist/cdp-session.js +0 -1
  36. package/dist/cdp-types.d.ts +0 -1
  37. package/dist/cdp-types.js +0 -1
  38. package/dist/chrome-discovery.d.ts +0 -1
  39. package/dist/chrome-discovery.js +0 -1
  40. package/dist/clean-html.d.ts +0 -1
  41. package/dist/clean-html.js +0 -1
  42. package/dist/cli.d.ts +0 -1
  43. package/dist/cli.js +9 -2
  44. package/dist/cloud-client.d.ts +0 -1
  45. package/dist/cloud-client.js +0 -1
  46. package/dist/create-logger.d.ts +0 -1
  47. package/dist/create-logger.js +0 -1
  48. package/dist/debugger-examples-types.d.ts +0 -1
  49. package/dist/debugger-examples-types.js +0 -1
  50. package/dist/debugger-examples.d.ts +0 -1
  51. package/dist/debugger-examples.js +0 -1
  52. package/dist/debugger.d.ts +0 -1
  53. package/dist/debugger.js +0 -1
  54. package/dist/diff-utils.d.ts +0 -1
  55. package/dist/diff-utils.js +0 -1
  56. package/dist/doctor.d.ts +0 -1
  57. package/dist/doctor.js +5 -7
  58. package/dist/editor-examples.d.ts +0 -1
  59. package/dist/editor-examples.js +0 -1
  60. package/dist/editor.d.ts +0 -1
  61. package/dist/editor.js +0 -1
  62. package/dist/env-compat.d.ts +0 -1
  63. package/dist/env-compat.js +0 -1
  64. package/dist/executor.d.ts +0 -1
  65. package/dist/executor.js +1 -2
  66. package/dist/extension/background.js +7 -3
  67. package/dist/extension/manifest.json +1 -1
  68. package/dist/ghost-browser.d.ts +0 -1
  69. package/dist/ghost-browser.js +0 -1
  70. package/dist/ghost-cursor-controller.d.ts +0 -1
  71. package/dist/ghost-cursor-controller.js +0 -1
  72. package/dist/ghost-cursor.d.ts +0 -1
  73. package/dist/ghost-cursor.js +0 -1
  74. package/dist/htmlrewrite.d.ts +0 -1
  75. package/dist/htmlrewrite.js +0 -1
  76. package/dist/index.d.ts +0 -1
  77. package/dist/index.js +0 -1
  78. package/dist/kill-port.d.ts +0 -1
  79. package/dist/kill-port.js +0 -1
  80. package/dist/kitty-graphics.d.ts +0 -1
  81. package/dist/kitty-graphics.js +0 -1
  82. package/dist/mcp.d.ts +0 -1
  83. package/dist/mcp.js +0 -1
  84. package/dist/package-paths.d.ts +0 -1
  85. package/dist/package-paths.js +0 -1
  86. package/dist/page-markdown.d.ts +0 -1
  87. package/dist/page-markdown.js +0 -1
  88. package/dist/performance-examples.d.ts +0 -1
  89. package/dist/performance-examples.js +0 -1
  90. package/dist/playwright-import.d.ts +0 -1
  91. package/dist/playwright-import.js +0 -1
  92. package/dist/product-paths.d.ts +0 -1
  93. package/dist/product-paths.js +0 -1
  94. package/dist/protocol.d.ts +0 -1
  95. package/dist/protocol.js +0 -1
  96. package/dist/react-source.d.ts +0 -1
  97. package/dist/react-source.js +0 -1
  98. package/dist/readability.js +1 -1
  99. package/dist/relay-client.d.ts +0 -1
  100. package/dist/relay-client.js +0 -1
  101. package/dist/relay-state.d.ts +0 -1
  102. package/dist/relay-state.js +0 -1
  103. package/dist/replay-ai-index.d.ts +0 -1
  104. package/dist/replay-ai-index.js +0 -1
  105. package/dist/replay-eval.d.ts +0 -1
  106. package/dist/replay-eval.js +0 -1
  107. package/dist/replay-handoff.d.ts +0 -1
  108. package/dist/replay-handoff.js +0 -1
  109. package/dist/replay-workflow-compiler.d.ts +0 -1
  110. package/dist/replay-workflow-compiler.js +0 -1
  111. package/dist/rrweb-recording-relay.d.ts +0 -1
  112. package/dist/rrweb-recording-relay.js +0 -1
  113. package/dist/rrweb-recording.d.ts +0 -1
  114. package/dist/rrweb-recording.js +0 -1
  115. package/dist/scoped-fs.d.ts +0 -1
  116. package/dist/scoped-fs.js +0 -1
  117. package/dist/selector-generator.js +1 -1
  118. package/dist/start-relay-server.d.ts +0 -1
  119. package/dist/start-relay-server.js +0 -1
  120. package/dist/styles-examples.d.ts +0 -1
  121. package/dist/styles-examples.js +0 -1
  122. package/dist/styles.d.ts +0 -1
  123. package/dist/styles.js +0 -1
  124. package/dist/tabwright-agent-skill.d.ts +0 -1
  125. package/dist/tabwright-agent-skill.js +0 -1
  126. package/dist/test-declarations.d.ts +0 -1
  127. package/dist/test-declarations.js +0 -1
  128. package/dist/utils.d.ts +0 -1
  129. package/dist/utils.js +2 -2
  130. package/dist/wait-for-page-load.d.ts +0 -1
  131. package/dist/wait-for-page-load.js +0 -1
  132. package/dist/workflow-capability.d.ts +0 -1
  133. package/dist/workflow-capability.js +0 -1
  134. package/package.json +9 -4
  135. package/readme.md +35 -0
  136. package/dist/aria-snapshot.d.ts.map +0 -1
  137. package/dist/aria-snapshot.js.map +0 -1
  138. package/dist/aria-snapshot.test.d.ts +0 -2
  139. package/dist/aria-snapshot.test.d.ts.map +0 -1
  140. package/dist/aria-snapshot.test.js +0 -270
  141. package/dist/aria-snapshot.test.js.map +0 -1
  142. package/dist/aria-snapshot.unit.test.d.ts +0 -2
  143. package/dist/aria-snapshot.unit.test.d.ts.map +0 -1
  144. package/dist/aria-snapshot.unit.test.js +0 -542
  145. package/dist/aria-snapshot.unit.test.js.map +0 -1
  146. package/dist/assets/cursors/screen-studio/pointer-macos-tahoe-data-url.d.ts.map +0 -1
  147. package/dist/assets/cursors/screen-studio/pointer-macos-tahoe-data-url.js.map +0 -1
  148. package/dist/browser-config.d.ts.map +0 -1
  149. package/dist/browser-config.js.map +0 -1
  150. package/dist/browser-install.d.ts.map +0 -1
  151. package/dist/browser-install.js.map +0 -1
  152. package/dist/browser-launch.d.ts.map +0 -1
  153. package/dist/browser-launch.js.map +0 -1
  154. package/dist/builtin-capabilities.d.ts.map +0 -1
  155. package/dist/builtin-capabilities.js.map +0 -1
  156. package/dist/capability-agent-skill.d.ts.map +0 -1
  157. package/dist/capability-agent-skill.js.map +0 -1
  158. package/dist/capability-auth-state.d.ts.map +0 -1
  159. package/dist/capability-auth-state.js.map +0 -1
  160. package/dist/capability-auth.d.ts.map +0 -1
  161. package/dist/capability-auth.js.map +0 -1
  162. package/dist/capability-cli-confirmation.test.d.ts +0 -2
  163. package/dist/capability-cli-confirmation.test.d.ts.map +0 -1
  164. package/dist/capability-cli-confirmation.test.js +0 -79
  165. package/dist/capability-cli-confirmation.test.js.map +0 -1
  166. package/dist/capability-options.d.ts.map +0 -1
  167. package/dist/capability-options.js.map +0 -1
  168. package/dist/capability-options.test.d.ts +0 -2
  169. package/dist/capability-options.test.d.ts.map +0 -1
  170. package/dist/capability-options.test.js +0 -81
  171. package/dist/capability-options.test.js.map +0 -1
  172. package/dist/capability-package.d.ts.map +0 -1
  173. package/dist/capability-package.js.map +0 -1
  174. package/dist/capability-package.test.d.ts +0 -2
  175. package/dist/capability-package.test.d.ts.map +0 -1
  176. package/dist/capability-package.test.js +0 -179
  177. package/dist/capability-package.test.js.map +0 -1
  178. package/dist/capability-registry.d.ts.map +0 -1
  179. package/dist/capability-registry.js.map +0 -1
  180. package/dist/capability-registry.test.d.ts +0 -2
  181. package/dist/capability-registry.test.d.ts.map +0 -1
  182. package/dist/capability-registry.test.js +0 -1683
  183. package/dist/capability-registry.test.js.map +0 -1
  184. package/dist/capability-runner.d.ts.map +0 -1
  185. package/dist/capability-runner.js.map +0 -1
  186. package/dist/capability-search-relevance.test.d.ts +0 -2
  187. package/dist/capability-search-relevance.test.d.ts.map +0 -1
  188. package/dist/capability-search-relevance.test.js +0 -67
  189. package/dist/capability-search-relevance.test.js.map +0 -1
  190. package/dist/capability-studio.d.ts.map +0 -1
  191. package/dist/capability-studio.js.map +0 -1
  192. package/dist/capability-studio.test.d.ts +0 -2
  193. package/dist/capability-studio.test.d.ts.map +0 -1
  194. package/dist/capability-studio.test.js +0 -41
  195. package/dist/capability-studio.test.js.map +0 -1
  196. package/dist/cdp-log.d.ts.map +0 -1
  197. package/dist/cdp-log.js.map +0 -1
  198. package/dist/cdp-log.test.d.ts +0 -2
  199. package/dist/cdp-log.test.d.ts.map +0 -1
  200. package/dist/cdp-log.test.js +0 -109
  201. package/dist/cdp-log.test.js.map +0 -1
  202. package/dist/cdp-relay.d.ts.map +0 -1
  203. package/dist/cdp-relay.js.map +0 -1
  204. package/dist/cdp-session.d.ts.map +0 -1
  205. package/dist/cdp-session.js.map +0 -1
  206. package/dist/cdp-types.d.ts.map +0 -1
  207. package/dist/cdp-types.js.map +0 -1
  208. package/dist/channel-owner-inspect.test.d.ts +0 -2
  209. package/dist/channel-owner-inspect.test.d.ts.map +0 -1
  210. package/dist/channel-owner-inspect.test.js +0 -75
  211. package/dist/channel-owner-inspect.test.js.map +0 -1
  212. package/dist/chrome-discovery.d.ts.map +0 -1
  213. package/dist/chrome-discovery.js.map +0 -1
  214. package/dist/chrome-discovery.test.d.ts +0 -2
  215. package/dist/chrome-discovery.test.d.ts.map +0 -1
  216. package/dist/chrome-discovery.test.js +0 -41
  217. package/dist/chrome-discovery.test.js.map +0 -1
  218. package/dist/clean-html.d.ts.map +0 -1
  219. package/dist/clean-html.js.map +0 -1
  220. package/dist/cli-help.test.d.ts +0 -2
  221. package/dist/cli-help.test.d.ts.map +0 -1
  222. package/dist/cli-help.test.js +0 -98
  223. package/dist/cli-help.test.js.map +0 -1
  224. package/dist/cli.d.ts.map +0 -1
  225. package/dist/cli.js.map +0 -1
  226. package/dist/cloud-client.d.ts.map +0 -1
  227. package/dist/cloud-client.js.map +0 -1
  228. package/dist/create-logger.d.ts.map +0 -1
  229. package/dist/create-logger.js.map +0 -1
  230. package/dist/debugger-examples-types.d.ts.map +0 -1
  231. package/dist/debugger-examples-types.js.map +0 -1
  232. package/dist/debugger-examples.d.ts.map +0 -1
  233. package/dist/debugger-examples.js.map +0 -1
  234. package/dist/debugger.d.ts.map +0 -1
  235. package/dist/debugger.js.map +0 -1
  236. package/dist/diff-utils.d.ts.map +0 -1
  237. package/dist/diff-utils.js.map +0 -1
  238. package/dist/diff-utils.test.d.ts +0 -2
  239. package/dist/diff-utils.test.d.ts.map +0 -1
  240. package/dist/diff-utils.test.js +0 -137
  241. package/dist/diff-utils.test.js.map +0 -1
  242. package/dist/doctor.d.ts.map +0 -1
  243. package/dist/doctor.js.map +0 -1
  244. package/dist/doctor.test.d.ts +0 -2
  245. package/dist/doctor.test.d.ts.map +0 -1
  246. package/dist/doctor.test.js +0 -208
  247. package/dist/doctor.test.js.map +0 -1
  248. package/dist/editor-examples.d.ts.map +0 -1
  249. package/dist/editor-examples.js.map +0 -1
  250. package/dist/editor.d.ts.map +0 -1
  251. package/dist/editor.js.map +0 -1
  252. package/dist/env-compat.d.ts.map +0 -1
  253. package/dist/env-compat.js.map +0 -1
  254. package/dist/executor.d.ts.map +0 -1
  255. package/dist/executor.js.map +0 -1
  256. package/dist/executor.unit.test.d.ts +0 -2
  257. package/dist/executor.unit.test.d.ts.map +0 -1
  258. package/dist/executor.unit.test.js +0 -143
  259. package/dist/executor.unit.test.js.map +0 -1
  260. package/dist/extension-connection.test.d.ts +0 -2
  261. package/dist/extension-connection.test.d.ts.map +0 -1
  262. package/dist/extension-connection.test.js +0 -708
  263. package/dist/extension-connection.test.js.map +0 -1
  264. package/dist/extension-icon-warning.test.d.ts +0 -2
  265. package/dist/extension-icon-warning.test.d.ts.map +0 -1
  266. package/dist/extension-icon-warning.test.js +0 -33
  267. package/dist/extension-icon-warning.test.js.map +0 -1
  268. package/dist/ghost-browser.d.ts.map +0 -1
  269. package/dist/ghost-browser.js.map +0 -1
  270. package/dist/ghost-cursor-controller.d.ts.map +0 -1
  271. package/dist/ghost-cursor-controller.js.map +0 -1
  272. package/dist/ghost-cursor.d.ts.map +0 -1
  273. package/dist/ghost-cursor.js.map +0 -1
  274. package/dist/htmlrewrite.d.ts.map +0 -1
  275. package/dist/htmlrewrite.js.map +0 -1
  276. package/dist/htmlrewrite.test.d.ts +0 -2
  277. package/dist/htmlrewrite.test.d.ts.map +0 -1
  278. package/dist/htmlrewrite.test.js +0 -7975
  279. package/dist/htmlrewrite.test.js.map +0 -1
  280. package/dist/index.d.ts.map +0 -1
  281. package/dist/index.js.map +0 -1
  282. package/dist/kill-port.d.ts.map +0 -1
  283. package/dist/kill-port.js.map +0 -1
  284. package/dist/kitty-graphics.d.ts.map +0 -1
  285. package/dist/kitty-graphics.js.map +0 -1
  286. package/dist/kitty-graphics.test.d.ts +0 -2
  287. package/dist/kitty-graphics.test.d.ts.map +0 -1
  288. package/dist/kitty-graphics.test.js +0 -125
  289. package/dist/kitty-graphics.test.js.map +0 -1
  290. package/dist/locator-selector.test.d.ts +0 -2
  291. package/dist/locator-selector.test.d.ts.map +0 -1
  292. package/dist/locator-selector.test.js +0 -98
  293. package/dist/locator-selector.test.js.map +0 -1
  294. package/dist/mcp-client.d.ts +0 -20
  295. package/dist/mcp-client.d.ts.map +0 -1
  296. package/dist/mcp-client.js +0 -56
  297. package/dist/mcp-client.js.map +0 -1
  298. package/dist/mcp.d.ts.map +0 -1
  299. package/dist/mcp.js.map +0 -1
  300. package/dist/on-mouse-action.test.d.ts +0 -2
  301. package/dist/on-mouse-action.test.d.ts.map +0 -1
  302. package/dist/on-mouse-action.test.js +0 -180
  303. package/dist/on-mouse-action.test.js.map +0 -1
  304. package/dist/options-page.test.d.ts +0 -2
  305. package/dist/options-page.test.d.ts.map +0 -1
  306. package/dist/options-page.test.js +0 -773
  307. package/dist/options-page.test.js.map +0 -1
  308. package/dist/package-paths.d.ts.map +0 -1
  309. package/dist/package-paths.js.map +0 -1
  310. package/dist/page-markdown.d.ts.map +0 -1
  311. package/dist/page-markdown.js.map +0 -1
  312. package/dist/performance-examples.d.ts.map +0 -1
  313. package/dist/performance-examples.js.map +0 -1
  314. package/dist/playwright-import.d.ts.map +0 -1
  315. package/dist/playwright-import.js.map +0 -1
  316. package/dist/popup-relocation.test.d.ts +0 -7
  317. package/dist/popup-relocation.test.d.ts.map +0 -1
  318. package/dist/popup-relocation.test.js +0 -139
  319. package/dist/popup-relocation.test.js.map +0 -1
  320. package/dist/product-paths.d.ts.map +0 -1
  321. package/dist/product-paths.js.map +0 -1
  322. package/dist/product-paths.test.d.ts +0 -2
  323. package/dist/product-paths.test.d.ts.map +0 -1
  324. package/dist/product-paths.test.js +0 -39
  325. package/dist/product-paths.test.js.map +0 -1
  326. package/dist/protocol.d.ts.map +0 -1
  327. package/dist/protocol.js.map +0 -1
  328. package/dist/protocol.test.d.ts +0 -2
  329. package/dist/protocol.test.d.ts.map +0 -1
  330. package/dist/protocol.test.js +0 -31
  331. package/dist/protocol.test.js.map +0 -1
  332. package/dist/react-source.d.ts.map +0 -1
  333. package/dist/react-source.js.map +0 -1
  334. package/dist/relay-client.d.ts.map +0 -1
  335. package/dist/relay-client.js.map +0 -1
  336. package/dist/relay-client.test.d.ts +0 -2
  337. package/dist/relay-client.test.d.ts.map +0 -1
  338. package/dist/relay-client.test.js +0 -305
  339. package/dist/relay-client.test.js.map +0 -1
  340. package/dist/relay-core.test.d.ts +0 -2
  341. package/dist/relay-core.test.d.ts.map +0 -1
  342. package/dist/relay-core.test.js +0 -1427
  343. package/dist/relay-core.test.js.map +0 -1
  344. package/dist/relay-navigation.test.d.ts +0 -2
  345. package/dist/relay-navigation.test.d.ts.map +0 -1
  346. package/dist/relay-navigation.test.js +0 -661
  347. package/dist/relay-navigation.test.js.map +0 -1
  348. package/dist/relay-session.test.d.ts +0 -2
  349. package/dist/relay-session.test.d.ts.map +0 -1
  350. package/dist/relay-session.test.js +0 -1121
  351. package/dist/relay-session.test.js.map +0 -1
  352. package/dist/relay-state.d.ts.map +0 -1
  353. package/dist/relay-state.js.map +0 -1
  354. package/dist/relay-state.test.d.ts +0 -2
  355. package/dist/relay-state.test.d.ts.map +0 -1
  356. package/dist/relay-state.test.js +0 -594
  357. package/dist/relay-state.test.js.map +0 -1
  358. package/dist/replay-ai-index.d.ts.map +0 -1
  359. package/dist/replay-ai-index.js.map +0 -1
  360. package/dist/replay-ai-index.test.d.ts +0 -2
  361. package/dist/replay-ai-index.test.d.ts.map +0 -1
  362. package/dist/replay-ai-index.test.js +0 -255
  363. package/dist/replay-ai-index.test.js.map +0 -1
  364. package/dist/replay-cli.test.d.ts +0 -2
  365. package/dist/replay-cli.test.d.ts.map +0 -1
  366. package/dist/replay-cli.test.js +0 -275
  367. package/dist/replay-cli.test.js.map +0 -1
  368. package/dist/replay-eval.d.ts.map +0 -1
  369. package/dist/replay-eval.js.map +0 -1
  370. package/dist/replay-handoff.d.ts.map +0 -1
  371. package/dist/replay-handoff.js.map +0 -1
  372. package/dist/replay-handoff.test.d.ts +0 -2
  373. package/dist/replay-handoff.test.d.ts.map +0 -1
  374. package/dist/replay-handoff.test.js +0 -123
  375. package/dist/replay-handoff.test.js.map +0 -1
  376. package/dist/replay-workflow-compiler.d.ts.map +0 -1
  377. package/dist/replay-workflow-compiler.js.map +0 -1
  378. package/dist/replay-workflow-compiler.test.d.ts +0 -2
  379. package/dist/replay-workflow-compiler.test.d.ts.map +0 -1
  380. package/dist/replay-workflow-compiler.test.js +0 -223
  381. package/dist/replay-workflow-compiler.test.js.map +0 -1
  382. package/dist/rrweb-recording-relay.d.ts.map +0 -1
  383. package/dist/rrweb-recording-relay.js.map +0 -1
  384. package/dist/rrweb-recording-relay.test.d.ts +0 -2
  385. package/dist/rrweb-recording-relay.test.d.ts.map +0 -1
  386. package/dist/rrweb-recording-relay.test.js +0 -85
  387. package/dist/rrweb-recording-relay.test.js.map +0 -1
  388. package/dist/rrweb-recording.d.ts.map +0 -1
  389. package/dist/rrweb-recording.js.map +0 -1
  390. package/dist/scoped-fs.d.ts.map +0 -1
  391. package/dist/scoped-fs.js.map +0 -1
  392. package/dist/scoped-fs.test.d.ts +0 -5
  393. package/dist/scoped-fs.test.d.ts.map +0 -1
  394. package/dist/scoped-fs.test.js +0 -73
  395. package/dist/scoped-fs.test.js.map +0 -1
  396. package/dist/skill-stub.test.d.ts +0 -2
  397. package/dist/skill-stub.test.d.ts.map +0 -1
  398. package/dist/skill-stub.test.js +0 -22
  399. package/dist/skill-stub.test.js.map +0 -1
  400. package/dist/snapshot-tools.test.d.ts +0 -2
  401. package/dist/snapshot-tools.test.d.ts.map +0 -1
  402. package/dist/snapshot-tools.test.js +0 -856
  403. package/dist/snapshot-tools.test.js.map +0 -1
  404. package/dist/start-relay-server.d.ts.map +0 -1
  405. package/dist/start-relay-server.js.map +0 -1
  406. package/dist/styles-examples.d.ts.map +0 -1
  407. package/dist/styles-examples.js.map +0 -1
  408. package/dist/styles.d.ts.map +0 -1
  409. package/dist/styles.js.map +0 -1
  410. package/dist/tabwright-agent-skill.d.ts.map +0 -1
  411. package/dist/tabwright-agent-skill.js.map +0 -1
  412. package/dist/tabwright-agent-skill.test.d.ts +0 -2
  413. package/dist/tabwright-agent-skill.test.d.ts.map +0 -1
  414. package/dist/tabwright-agent-skill.test.js +0 -51
  415. package/dist/tabwright-agent-skill.test.js.map +0 -1
  416. package/dist/test-declarations.d.ts.map +0 -1
  417. package/dist/test-declarations.js.map +0 -1
  418. package/dist/test-utils.d.ts +0 -69
  419. package/dist/test-utils.d.ts.map +0 -1
  420. package/dist/test-utils.js +0 -448
  421. package/dist/test-utils.js.map +0 -1
  422. package/dist/test-utils.test.d.ts +0 -2
  423. package/dist/test-utils.test.d.ts.map +0 -1
  424. package/dist/test-utils.test.js +0 -55
  425. package/dist/test-utils.test.js.map +0 -1
  426. package/dist/utils.d.ts.map +0 -1
  427. package/dist/utils.js.map +0 -1
  428. package/dist/wait-for-page-load.d.ts.map +0 -1
  429. package/dist/wait-for-page-load.js.map +0 -1
  430. package/dist/workflow-capability.d.ts.map +0 -1
  431. package/dist/workflow-capability.js.map +0 -1
  432. package/dist/workflow-script-flow.test.d.ts +0 -2
  433. package/dist/workflow-script-flow.test.d.ts.map +0 -1
  434. package/dist/workflow-script-flow.test.js +0 -285
  435. package/dist/workflow-script-flow.test.js.map +0 -1
  436. package/src/__snapshots__/x.com.processed.html +0 -1003
  437. package/src/__snapshots__/x.com.processed.withStyles.html +0 -2720
  438. package/src/a11y-client.ts +0 -241
  439. package/src/aria-snapshot.test.ts +0 -311
  440. package/src/aria-snapshot.ts +0 -1681
  441. package/src/aria-snapshot.unit.test.ts +0 -615
  442. package/src/aria-snapshots/github-interactive.txt +0 -193
  443. package/src/aria-snapshots/github-raw.txt +0 -309
  444. package/src/aria-snapshots/hackernews-interactive.txt +0 -477
  445. package/src/aria-snapshots/hackernews-raw.txt +0 -428
  446. package/src/aria-snapshots/prosemirror-interactive.txt +0 -66
  447. package/src/aria-snapshots/prosemirror-raw.txt +0 -145
  448. package/src/assets/aria-labels-hacker-news.png +0 -0
  449. package/src/assets/aria-labels-old-reddit.png +0 -0
  450. package/src/assets/cursors/screen-studio/pointer-macos-tahoe-data-url.ts +0 -5
  451. package/src/assets/cursors/screen-studio/pointer-macos-tahoe.svg +0 -18
  452. package/src/assets/x.com.html +0 -32946
  453. package/src/browser-config.ts +0 -179
  454. package/src/browser-install.ts +0 -284
  455. package/src/browser-launch.ts +0 -75
  456. package/src/builtin-capabilities.ts +0 -2765
  457. package/src/capability-agent-skill.ts +0 -305
  458. package/src/capability-auth-state.ts +0 -197
  459. package/src/capability-auth.ts +0 -249
  460. package/src/capability-cli-confirmation.test.ts +0 -90
  461. package/src/capability-options.test.ts +0 -89
  462. package/src/capability-options.ts +0 -57
  463. package/src/capability-package.test.ts +0 -204
  464. package/src/capability-package.ts +0 -555
  465. package/src/capability-registry.test.ts +0 -1905
  466. package/src/capability-registry.ts +0 -1234
  467. package/src/capability-runner.ts +0 -801
  468. package/src/capability-search-relevance.test.ts +0 -73
  469. package/src/capability-studio.test.ts +0 -45
  470. package/src/capability-studio.ts +0 -641
  471. package/src/cdp-log.test.ts +0 -131
  472. package/src/cdp-log.ts +0 -112
  473. package/src/cdp-relay.ts +0 -2944
  474. package/src/cdp-session.ts +0 -77
  475. package/src/cdp-types.ts +0 -158
  476. package/src/channel-owner-inspect.test.ts +0 -94
  477. package/src/chrome-discovery.test.ts +0 -50
  478. package/src/chrome-discovery.ts +0 -220
  479. package/src/clean-html.ts +0 -141
  480. package/src/cli-help.test.ts +0 -123
  481. package/src/cli.ts +0 -3181
  482. package/src/cloud-client.ts +0 -179
  483. package/src/create-logger.ts +0 -38
  484. package/src/debugger-examples-types.ts +0 -16
  485. package/src/debugger-examples.ts +0 -66
  486. package/src/debugger.ts +0 -708
  487. package/src/diff-utils.test.ts +0 -152
  488. package/src/diff-utils.ts +0 -70
  489. package/src/doctor.test.ts +0 -244
  490. package/src/doctor.ts +0 -321
  491. package/src/editor-examples.ts +0 -158
  492. package/src/editor.ts +0 -426
  493. package/src/env-compat.ts +0 -28
  494. package/src/executor.ts +0 -1824
  495. package/src/executor.unit.test.ts +0 -168
  496. package/src/extension-connection.test.ts +0 -855
  497. package/src/extension-icon-warning.test.ts +0 -45
  498. package/src/ghost-browser.ts +0 -149
  499. package/src/ghost-cursor-client.ts +0 -494
  500. package/src/ghost-cursor-controller.ts +0 -129
  501. package/src/ghost-cursor.ts +0 -123
  502. package/src/htmlrewrite.test.ts +0 -8008
  503. package/src/htmlrewrite.ts +0 -390
  504. package/src/index.ts +0 -53
  505. package/src/kill-port.ts +0 -219
  506. package/src/kitty-graphics.test.ts +0 -139
  507. package/src/kitty-graphics.ts +0 -79
  508. package/src/locator-selector.test.ts +0 -119
  509. package/src/mcp-client.ts +0 -78
  510. package/src/mcp.ts +0 -629
  511. package/src/on-mouse-action.test.ts +0 -226
  512. package/src/options-page.test.ts +0 -839
  513. package/src/package-paths.ts +0 -38
  514. package/src/page-markdown.ts +0 -240
  515. package/src/performance-examples.ts +0 -186
  516. package/src/playwright-import.ts +0 -59
  517. package/src/popup-relocation.test.ts +0 -163
  518. package/src/product-paths.test.ts +0 -47
  519. package/src/product-paths.ts +0 -28
  520. package/src/protocol.test.ts +0 -52
  521. package/src/protocol.ts +0 -351
  522. package/src/react-source.ts +0 -379
  523. package/src/relay-client.test.ts +0 -375
  524. package/src/relay-client.ts +0 -572
  525. package/src/relay-core.test.ts +0 -1603
  526. package/src/relay-navigation.test.ts +0 -790
  527. package/src/relay-session.test.ts +0 -1375
  528. package/src/relay-state.test.ts +0 -729
  529. package/src/relay-state.ts +0 -561
  530. package/src/replay-ai-index.test.ts +0 -278
  531. package/src/replay-ai-index.ts +0 -872
  532. package/src/replay-cli.test.ts +0 -325
  533. package/src/replay-eval.ts +0 -1039
  534. package/src/replay-handoff.test.ts +0 -163
  535. package/src/replay-handoff.ts +0 -109
  536. package/src/replay-workflow-compiler.test.ts +0 -250
  537. package/src/replay-workflow-compiler.ts +0 -700
  538. package/src/resource.md +0 -409
  539. package/src/rrweb-recording-relay.test.ts +0 -99
  540. package/src/rrweb-recording-relay.ts +0 -400
  541. package/src/rrweb-recording.ts +0 -322
  542. package/src/scoped-fs.test.ts +0 -80
  543. package/src/scoped-fs.ts +0 -420
  544. package/src/skill-stub.test.ts +0 -24
  545. package/src/snapshot-tools.test.ts +0 -1017
  546. package/src/snapshots/hacker-news-accessibility-full.md +0 -81
  547. package/src/snapshots/hacker-news-accessibility-interactive.md +0 -43
  548. package/src/snapshots/page-markdown-output.txt +0 -16
  549. package/src/snapshots/shadcn-ui-accessibility-full.md +0 -201
  550. package/src/snapshots/shadcn-ui-accessibility-interactive.md +0 -109
  551. package/src/start-relay-server.ts +0 -69
  552. package/src/styles-examples.ts +0 -84
  553. package/src/styles.ts +0 -343
  554. package/src/tabwright-agent-skill.test.ts +0 -61
  555. package/src/tabwright-agent-skill.ts +0 -105
  556. package/src/test-declarations.ts +0 -13
  557. package/src/test-utils.test.ts +0 -70
  558. package/src/test-utils.ts +0 -566
  559. package/src/utils.ts +0 -78
  560. package/src/wait-for-page-load.ts +0 -198
  561. package/src/workflow-capability.ts +0 -417
  562. package/src/workflow-script-flow.test.ts +0 -388
@@ -1,77 +0,0 @@
1
- import type { Page, CDPSession as PlaywrightCDPSession } from '@xmorse/playwright-core'
2
- import type { ProtocolMapping } from 'devtools-protocol/types/protocol-mapping.js'
3
-
4
- /**
5
- * Type-safe CDP session interface using devtools-protocol ProtocolMapping.
6
- * Provides autocomplete and type checking for CDP commands and events.
7
- * Return types are inferred from the command string (e.g. 'Page.getLayoutMetrics'
8
- * returns Protocol.Page.GetLayoutMetricsResponse).
9
- */
10
- export interface ICDPSession {
11
- send<K extends keyof ProtocolMapping.Commands>(
12
- method: K,
13
- params?: ProtocolMapping.Commands[K]['paramsType'][0],
14
- sessionId?: string | null,
15
- ): Promise<ProtocolMapping.Commands[K]['returnType']>
16
-
17
- on<K extends keyof ProtocolMapping.Events>(
18
- event: K,
19
- callback: (params: ProtocolMapping.Events[K][0]) => void,
20
- ): unknown
21
-
22
- off<K extends keyof ProtocolMapping.Events>(
23
- event: K,
24
- callback: (params: ProtocolMapping.Events[K][0]) => void,
25
- ): unknown
26
-
27
- detach(): Promise<void>
28
- getSessionId?(): string | null
29
- }
30
-
31
- /**
32
- * Wraps Playwright's CDPSession (from context.getExistingCDPSession) into an ICDPSession.
33
- * This reuses Playwright's internal CDP WebSocket instead of creating a new one,
34
- * which is important for the relay server where Target.attachToTarget is intercepted.
35
- */
36
- export class PlaywrightCDPSessionAdapter implements ICDPSession {
37
- private _playwrightSession: PlaywrightCDPSession
38
-
39
- constructor(playwrightSession: PlaywrightCDPSession) {
40
- this._playwrightSession = playwrightSession
41
- }
42
-
43
- async send<K extends keyof ProtocolMapping.Commands>(
44
- method: K,
45
- params?: ProtocolMapping.Commands[K]['paramsType'][0],
46
- ): Promise<ProtocolMapping.Commands[K]['returnType']> {
47
- return await this._playwrightSession.send(method as never, params as never)
48
- }
49
-
50
- on<K extends keyof ProtocolMapping.Events>(event: K, callback: (params: ProtocolMapping.Events[K][0]) => void): this {
51
- this._playwrightSession.on(event as never, callback as never)
52
- return this
53
- }
54
-
55
- off<K extends keyof ProtocolMapping.Events>(
56
- event: K,
57
- callback: (params: ProtocolMapping.Events[K][0]) => void,
58
- ): this {
59
- this._playwrightSession.off(event as never, callback as never)
60
- return this
61
- }
62
-
63
- async detach(): Promise<void> {
64
- await this._playwrightSession.detach()
65
- }
66
- }
67
-
68
- /**
69
- * Gets a CDP session for a page by reusing Playwright's internal existing CDP session.
70
- * This uses the same WebSocket Playwright already has, avoiding new connections.
71
- * Works through the relay because it doesn't call Target.attachToTarget.
72
- */
73
- export async function getCDPSessionForPage({ page }: { page: Page }): Promise<PlaywrightCDPSessionAdapter> {
74
- const context = page.context()
75
- const playwrightSession = await context.getExistingCDPSession(page)
76
- return new PlaywrightCDPSessionAdapter(playwrightSession)
77
- }
package/src/cdp-types.ts DELETED
@@ -1,158 +0,0 @@
1
- import type { Protocol } from 'devtools-protocol'
2
- import type { ProtocolMapping } from 'devtools-protocol/types/protocol-mapping.js'
3
-
4
- export type CDPCommandSource = 'playwriter'
5
-
6
- export type CDPCommandFor<T extends keyof ProtocolMapping.Commands> = {
7
- id: number
8
- sessionId?: string
9
- method: T
10
- params?: ProtocolMapping.Commands[T]['paramsType'][0]
11
- source?: CDPCommandSource
12
- }
13
-
14
- export type CDPCommand = {
15
- [K in keyof ProtocolMapping.Commands]: CDPCommandFor<K>
16
- }[keyof ProtocolMapping.Commands]
17
-
18
- export type CDPResponseFor<T extends keyof ProtocolMapping.Commands> = {
19
- id: number
20
- sessionId?: string
21
- result?: ProtocolMapping.Commands[T]['returnType']
22
- error?: { code?: number; message: string }
23
- }
24
-
25
- export type CDPResponse = {
26
- [K in keyof ProtocolMapping.Commands]: CDPResponseFor<K>
27
- }[keyof ProtocolMapping.Commands]
28
-
29
- export type CDPEventFor<T extends keyof ProtocolMapping.Events> = {
30
- method: T
31
- sessionId?: string
32
- params?: ProtocolMapping.Events[T][0]
33
- }
34
-
35
- export type CDPEvent = {
36
- [K in keyof ProtocolMapping.Events]: CDPEventFor<K>
37
- }[keyof ProtocolMapping.Events]
38
-
39
- export type CDPResponseBase = {
40
- id: number
41
- sessionId?: string
42
- result?: unknown
43
- error?: { code?: number; message: string }
44
- }
45
-
46
- export type CDPEventBase = {
47
- method: string
48
- sessionId?: string
49
- params?: unknown
50
- }
51
-
52
- export type CDPMessage = CDPCommand | CDPResponse | CDPEvent
53
-
54
- export type RelayServerEvents = {
55
- 'cdp:command': (data: { clientId: string; command: CDPCommand }) => void
56
- 'cdp:event': (data: { event: CDPEventBase; sessionId?: string }) => void
57
- 'cdp:response': (data: { clientId: string; response: CDPResponseBase; command: CDPCommand }) => void
58
- }
59
-
60
- export { Protocol, ProtocolMapping }
61
-
62
- // types tests. to see if types are right with some simple examples
63
- if (false as any) {
64
- const browserVersionCommand = {
65
- id: 1,
66
- method: 'Browser.getVersion',
67
- } satisfies CDPCommand
68
-
69
- const browserVersionResponse = {
70
- id: 1,
71
- result: {
72
- protocolVersion: '1.3',
73
- product: 'Chrome',
74
- revision: '123',
75
- userAgent: 'Mozilla/5.0',
76
- jsVersion: 'V8',
77
- },
78
- } satisfies CDPResponse
79
-
80
- const targetAttachCommand = {
81
- id: 2,
82
- method: 'Target.setAutoAttach',
83
- params: {
84
- autoAttach: true,
85
- waitForDebuggerOnStart: false,
86
- },
87
- } satisfies CDPCommand
88
-
89
- const targetAttachResponse = {
90
- id: 2,
91
- result: undefined,
92
- } satisfies CDPResponse
93
-
94
- const attachedToTargetEvent = {
95
- method: 'Target.attachedToTarget',
96
- params: {
97
- sessionId: 'session-1',
98
- targetInfo: {
99
- targetId: 'target-1',
100
- type: 'page',
101
- title: 'Example',
102
- url: 'https://example.com',
103
- attached: true,
104
- canAccessOpener: false,
105
- },
106
- waitingForDebugger: false,
107
- },
108
- } satisfies CDPEvent
109
-
110
- const consoleMessageEvent = {
111
- method: 'Runtime.consoleAPICalled',
112
- params: {
113
- type: 'log',
114
- args: [],
115
- executionContextId: 1,
116
- timestamp: 123456789,
117
- },
118
- } satisfies CDPEvent
119
-
120
- const pageNavigateCommand = {
121
- id: 3,
122
- method: 'Page.navigate',
123
- params: {
124
- url: 'https://example.com',
125
- },
126
- } satisfies CDPCommand
127
-
128
- const pageNavigateResponse = {
129
- id: 3,
130
- result: {
131
- frameId: 'frame-1',
132
- },
133
- } satisfies CDPResponse
134
-
135
- const networkRequestEvent = {
136
- method: 'Network.requestWillBeSent',
137
- sessionId: 'session-1',
138
- params: {
139
- requestId: 'req-1',
140
- loaderId: 'loader-1',
141
- documentURL: 'https://example.com',
142
- request: {
143
- url: 'https://example.com/api',
144
- method: 'GET',
145
- headers: {},
146
- initialPriority: 'High',
147
- referrerPolicy: 'no-referrer',
148
- },
149
- timestamp: 123456789,
150
- wallTime: 123456789,
151
- initiator: {
152
- type: 'other',
153
- },
154
- redirectHasExtraInfo: false,
155
- type: 'XHR',
156
- },
157
- } satisfies CDPEvent
158
- }
@@ -1,94 +0,0 @@
1
- /**
2
- * Regression test for https://github.com/remorses/playwriter/issues/82
3
- *
4
- * User reported that running:
5
- * tabwright -s 1 -e 'await page.goto("https://example.com")'
6
- * printed "all env vars" to the terminal.
7
- *
8
- * Root cause: `await page.goto(...)` auto-returns the Playwright Response.
9
- * util.inspect with depth:4 traversed Response → _connection → _platform →
10
- * env = process.env and dumped every environment variable.
11
- *
12
- * Fix: custom util.inspect handler on ChannelOwner and on the channel proxy
13
- * target. See playwright/packages/playwright-core/src/client/channelOwner.ts
14
- */
15
- import { describe, it, expect } from 'vitest'
16
- import util from 'node:util'
17
-
18
- describe('issue #82 - env var leak via util.inspect on Playwright objects', () => {
19
- it('channel proxy target must NOT leak _platform.env via util.inspect', () => {
20
- // Simulate the channel proxy structure from ChannelOwner._createChannel:
21
- // a bare EventEmitter target wrapped in a Proxy, with _platform.env set
22
- // to process.env. Before the fix, util.inspect traversed this.
23
- const SECRET_KEY = 'ISSUE_82_TEST_SECRET_KEY'
24
- const SECRET_VALUE = 'this-should-never-appear-in-inspect-output'
25
-
26
- const base: any = {
27
- _events: {},
28
- _eventsCount: 0,
29
- _maxListeners: undefined,
30
- _platform: {
31
- env: { [SECRET_KEY]: SECRET_VALUE, HOME: '/home/user' },
32
- colors: {},
33
- },
34
- }
35
-
36
- // Simulate the fix: custom inspect set directly on the base target.
37
- base[Symbol.for('nodejs.util.inspect.custom')] = function () {
38
- return 'Channel<Response@test-guid>'
39
- }
40
-
41
- const proxy = new Proxy(base, { get: (obj, prop) => obj[prop] })
42
-
43
- // Inspect both directly and nested inside another object (as happens
44
- // when auto-returning a Response whose _initializer.request is a channel)
45
- const directInspect = util.inspect(proxy, { depth: 4 })
46
- const nestedInspect = util.inspect(
47
- { request: proxy, url: 'https://example.com' },
48
- { depth: 4 },
49
- )
50
-
51
- expect(directInspect).not.toContain(SECRET_VALUE)
52
- expect(directInspect).not.toContain(SECRET_KEY)
53
- expect(nestedInspect).not.toContain(SECRET_VALUE)
54
- expect(nestedInspect).not.toContain(SECRET_KEY)
55
-
56
- expect(directInspect).toMatchInlineSnapshot(`"Channel<Response@test-guid>"`)
57
- expect(nestedInspect).toMatchInlineSnapshot(`"{ request: Channel<Response@test-guid>, url: 'https://example.com' }"`)
58
- })
59
-
60
- it('ChannelOwner instance must NOT leak _platform.env via util.inspect', () => {
61
- // Simulate a ChannelOwner instance — this is what the user actually
62
- // auto-returns from `await page.goto(url)`.
63
- const SECRET_VALUE = 'issue-82-channelowner-secret'
64
-
65
- // Simulate a ChannelOwner instance via a plain object. The real fix in
66
- // playwright-core adds a computed Symbol method to the ChannelOwner class.
67
- const instance: any = {
68
- _type: 'Response',
69
- _guid: 'response@abc123',
70
- _connection: { _platform: { env: { LEAKED: SECRET_VALUE } } },
71
- _initializer: {
72
- url: 'https://example.com/',
73
- status: 200,
74
- statusText: 'OK',
75
- },
76
- }
77
- instance[Symbol.for('nodejs.util.inspect.custom')] = function (
78
- _depth: number,
79
- options: any,
80
- inspect: (value: any, opts: any) => string,
81
- ) {
82
- const header = `${this._type}@${this._guid}`
83
- const initializerDepth =
84
- typeof options?.depth === 'number' ? Math.max(options.depth - 1, 0) : 2
85
- return `${header} ${inspect(this._initializer, { ...options, depth: initializerDepth })}`
86
- }
87
- const output = util.inspect(instance, { depth: 4 })
88
-
89
- expect(output).not.toContain(SECRET_VALUE)
90
- expect(output).toMatchInlineSnapshot(
91
- `"Response@response@abc123 { url: 'https://example.com/', status: 200, statusText: 'OK' }"`,
92
- )
93
- })
94
- })
@@ -1,50 +0,0 @@
1
- import { describe, test, expect } from 'vitest'
2
- import { parseDevToolsActivePort } from './chrome-discovery.js'
3
-
4
- describe('parseDevToolsActivePort', () => {
5
- test('parses valid contents', () => {
6
- const result = parseDevToolsActivePort('9222\n/devtools/browser/abc-123-def\n')
7
- expect(result).toMatchInlineSnapshot(`
8
- {
9
- "port": 9222,
10
- "wsPath": "/devtools/browser/abc-123-def",
11
- }
12
- `)
13
- })
14
-
15
- test('parses with extra whitespace', () => {
16
- const result = parseDevToolsActivePort(' 9222 \n /devtools/browser/abc \n')
17
- expect(result).toMatchInlineSnapshot(`
18
- {
19
- "port": 9222,
20
- "wsPath": "/devtools/browser/abc",
21
- }
22
- `)
23
- })
24
-
25
- test('returns null for single line', () => {
26
- expect(parseDevToolsActivePort('9222')).toBeNull()
27
- })
28
-
29
- test('returns null for empty string', () => {
30
- expect(parseDevToolsActivePort('')).toBeNull()
31
- })
32
-
33
- test('returns null for invalid port', () => {
34
- expect(parseDevToolsActivePort('abc\n/devtools/browser/123')).toBeNull()
35
- })
36
-
37
- test('returns null for port 0', () => {
38
- expect(parseDevToolsActivePort('0\n/devtools/browser/123')).toBeNull()
39
- })
40
-
41
- test('returns null for port > 65535', () => {
42
- expect(parseDevToolsActivePort('99999\n/devtools/browser/123')).toBeNull()
43
- })
44
-
45
- test('returns null for invalid ws path', () => {
46
- expect(parseDevToolsActivePort('9222\n/some/other/path')).toBeNull()
47
- })
48
- })
49
-
50
-
@@ -1,220 +0,0 @@
1
- /**
2
- * Chrome instance discovery for direct CDP connections.
3
- *
4
- * Probes the default CDP port (9222) via GET /json/version.
5
- * If Chrome responds with a valid webSocketDebuggerUrl, the instance is usable.
6
- *
7
- * Chrome 136+ with chrome://inspect debugging returns 404 on all HTTP endpoints
8
- * but still accepts WebSocket connections on /devtools/browser/*. In that case
9
- * (status 'blocked'), we return a synthetic wsUrl — the actual WS connection
10
- * (which may trigger Chrome's approval dialog) only happens when the user
11
- * explicitly runs a command, not during discovery.
12
- *
13
- * For non-default ports or remote hosts, pass an explicit endpoint with
14
- * --direct host:port or --direct ws://....
15
- */
16
-
17
- export interface DiscoveredInstance {
18
- browser: string
19
- port: number
20
- wsUrl: string
21
- profiles: Array<{ name: string; email: string }>
22
- dataDir: string | null
23
- }
24
-
25
- export interface ParsedActivePort {
26
- port: number
27
- wsPath: string
28
- }
29
-
30
- /**
31
- * Parse the contents of a DevToolsActivePort file.
32
- * Format: line 1 = port number, line 2 = /devtools/browser/{guid}
33
- */
34
- export function parseDevToolsActivePort(contents: string): ParsedActivePort | null {
35
- const lines = contents.trim().split('\n')
36
- if (lines.length < 2) {
37
- return null
38
- }
39
- const port = parseInt(lines[0].trim(), 10)
40
- if (isNaN(port) || port <= 0 || port > 65535) {
41
- return null
42
- }
43
- const wsPath = lines[1].trim()
44
- if (!wsPath.startsWith('/devtools/browser/')) {
45
- return null
46
- }
47
- return { port, wsPath }
48
- }
49
-
50
- interface JsonVersionResponse {
51
- Browser?: string
52
- webSocketDebuggerUrl?: string
53
- 'Protocol-Version'?: string
54
- }
55
-
56
- type PortProbeStatus =
57
- | { type: 'live'; wsUrl: string; browser: string }
58
- /** HTTP response received but no CDP data (Chrome 136+ returns 404 on all HTTP
59
- * endpoints but still accepts WS on /devtools/browser/*). We can't get browser
60
- * info without a WS connection which would trigger Chrome's approval dialog. */
61
- | { type: 'blocked'; port: number; hostname: string }
62
- /** ECONNREFUSED or timeout — nothing is listening */
63
- | { type: 'dead' }
64
-
65
- /**
66
- * Probe a port via GET /json/version.
67
- *
68
- * Returns:
69
- * - 'live' — Chrome responded with valid CDP JSON containing webSocketDebuggerUrl
70
- * - 'blocked' — HTTP response received but no CDP info (Chrome 136+ default profile)
71
- * - 'dead' — connection refused or timeout (nothing listening)
72
- */
73
- async function probePortStatus(port: number, hostname = '127.0.0.1'): Promise<PortProbeStatus> {
74
- try {
75
- const response = await fetch(`http://${hostname}:${port}/json/version`, {
76
- signal: AbortSignal.timeout(1000),
77
- })
78
- if (!response.ok) {
79
- await response.text() // consume body
80
- return { type: 'blocked', port, hostname }
81
- }
82
- const data = (await response.json()) as JsonVersionResponse
83
- if (data.webSocketDebuggerUrl) {
84
- return { type: 'live', wsUrl: data.webSocketDebuggerUrl, browser: data.Browser || 'Unknown' }
85
- }
86
- return { type: 'blocked', port, hostname }
87
- } catch {
88
- return { type: 'dead' }
89
- }
90
- }
91
-
92
- /**
93
- * Probe a port via GET /json/version.
94
- * Returns the webSocketDebuggerUrl and browser name, or null.
95
- */
96
- export async function probePort(port: number, hostname = '127.0.0.1'): Promise<{ wsUrl: string; browser: string } | null> {
97
- const status = await probePortStatus(port, hostname)
98
- if (status.type === 'live') {
99
- return { wsUrl: status.wsUrl, browser: status.browser }
100
- }
101
- return null
102
- }
103
-
104
- /**
105
- * Discover Chrome on the default CDP port (9222).
106
- *
107
- * Probes /json/version. If Chrome responds with valid CDP JSON, returns the
108
- * instance with full browser info. If Chrome returns 404 (Chrome 136+ with
109
- * chrome://inspect debugging), returns a synthetic instance — the browser
110
- * version is unknown until an actual WS connection is made.
111
- */
112
- export async function discoverChromeInstances(): Promise<DiscoveredInstance[]> {
113
- const status = await probePortStatus(9222)
114
-
115
- if (status.type === 'live') {
116
- return [
117
- {
118
- browser: parseBrowserVersion(status.browser),
119
- port: 9222,
120
- wsUrl: status.wsUrl,
121
- profiles: [],
122
- dataDir: null,
123
- },
124
- ]
125
- }
126
-
127
- if (status.type === 'blocked') {
128
- return [
129
- {
130
- browser: 'Chrome',
131
- port: status.port,
132
- wsUrl: makeDirectWsUrl(status.hostname, status.port),
133
- profiles: [],
134
- dataDir: null,
135
- },
136
- ]
137
- }
138
-
139
- return []
140
- }
141
-
142
- /** Build a ws:// URL for direct CDP. The path is left bare — Chrome 136+
143
- * accepts any value under /devtools/browser/. Call appendSessionToWsUrl()
144
- * before connecting to make the path unique per session. */
145
- function makeDirectWsUrl(hostname: string, port: number): string {
146
- return `ws://${hostname}:${port}/devtools/browser/`
147
- }
148
-
149
- /** Append a session ID to a /devtools/browser/ ws URL to make it unique.
150
- * If the URL already has a full GUID path (e.g. from /json/version), return as-is. */
151
- export function appendSessionToWsUrl(wsUrl: string, sessionId: string): string {
152
- // Only append if the path ends with / (our synthetic URLs from blocked probes)
153
- if (wsUrl.endsWith('/')) {
154
- return `${wsUrl}${sessionId}`
155
- }
156
- return wsUrl
157
- }
158
-
159
- /**
160
- * Resolve a --direct input value to a WebSocket URL.
161
- *
162
- * Accepts:
163
- * - ws:// or wss:// URL — returned as-is
164
- * - host:port — probes /json/version to get the webSocketDebuggerUrl
165
- *
166
- * Throws with a clear message if the endpoint can't be resolved.
167
- */
168
- export async function resolveDirectInput(input: string): Promise<string> {
169
- if (input.startsWith('ws://') || input.startsWith('wss://')) {
170
- return input
171
- }
172
-
173
- // Cloud browser providers (Browser Use, Browserbase) return https:// CDP URLs.
174
- // Convert to wss:// since the WebSocket connection uses the same hostname.
175
- if (input.startsWith('https://')) {
176
- return 'wss://' + input.slice('https://'.length)
177
- }
178
- if (input.startsWith('http://')) {
179
- return 'ws://' + input.slice('http://'.length)
180
- }
181
-
182
- const match = input.match(/^([^:]+):(\d+)$/)
183
- if (!match) {
184
- throw new Error(
185
- `Invalid --direct value: expected a ws:// URL or host:port (e.g. localhost:9222), got: ${input}`,
186
- )
187
- }
188
-
189
- const [, hostname, portStr] = match
190
- const port = parseInt(portStr, 10)
191
- const status = await probePortStatus(port, hostname)
192
-
193
- if (status.type === 'live') {
194
- return status.wsUrl
195
- }
196
-
197
- if (status.type === 'blocked') {
198
- // Chrome 136+ returns 404 on HTTP but accepts WS on /devtools/browser/*
199
- return makeDirectWsUrl(hostname, port)
200
- }
201
-
202
- throw new Error(
203
- `Nothing found on ${hostname}:${port}. Is Chrome running with remote debugging enabled? ` +
204
- `Try: chrome://inspect/#remote-debugging`,
205
- )
206
- }
207
-
208
- function parseBrowserVersion(browserString: string): string {
209
- if (browserString.startsWith('HeadlessChrome/')) {
210
- return 'Chrome (Headless)'
211
- }
212
- if (browserString.startsWith('Chrome/')) {
213
- return 'Chrome'
214
- }
215
- const slashIndex = browserString.indexOf('/')
216
- if (slashIndex > 0) {
217
- return browserString.slice(0, slashIndex)
218
- }
219
- return browserString
220
- }