devharness 0.8.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 (627) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +185 -0
  3. package/build/atomic-write.d.ts +28 -0
  4. package/build/atomic-write.d.ts.map +1 -0
  5. package/build/atomic-write.js +126 -0
  6. package/build/atomic-write.js.map +1 -0
  7. package/build/cdp-manager.d.ts +524 -0
  8. package/build/cdp-manager.d.ts.map +1 -0
  9. package/build/cdp-manager.js +1828 -0
  10. package/build/cdp-manager.js.map +1 -0
  11. package/build/cdp-manager.test.d.ts +6 -0
  12. package/build/cdp-manager.test.d.ts.map +1 -0
  13. package/build/cdp-manager.test.js +546 -0
  14. package/build/cdp-manager.test.js.map +1 -0
  15. package/build/chrome-launcher.d.ts +400 -0
  16. package/build/chrome-launcher.d.ts.map +1 -0
  17. package/build/chrome-launcher.js +1071 -0
  18. package/build/chrome-launcher.js.map +1 -0
  19. package/build/chrome-launcher.test.d.ts +11 -0
  20. package/build/chrome-launcher.test.d.ts.map +1 -0
  21. package/build/chrome-launcher.test.js +204 -0
  22. package/build/chrome-launcher.test.js.map +1 -0
  23. package/build/clickable-cache.d.ts +73 -0
  24. package/build/clickable-cache.d.ts.map +1 -0
  25. package/build/clickable-cache.js +90 -0
  26. package/build/clickable-cache.js.map +1 -0
  27. package/build/command-recorder.d.ts +401 -0
  28. package/build/command-recorder.d.ts.map +1 -0
  29. package/build/command-recorder.js +701 -0
  30. package/build/command-recorder.js.map +1 -0
  31. package/build/config.d.ts +390 -0
  32. package/build/config.d.ts.map +1 -0
  33. package/build/config.js +826 -0
  34. package/build/config.js.map +1 -0
  35. package/build/config.test.d.ts +2 -0
  36. package/build/config.test.d.ts.map +1 -0
  37. package/build/config.test.js +112 -0
  38. package/build/config.test.js.map +1 -0
  39. package/build/connection-manager.d.ts +159 -0
  40. package/build/connection-manager.d.ts.map +1 -0
  41. package/build/connection-manager.js +432 -0
  42. package/build/connection-manager.js.map +1 -0
  43. package/build/connection-manager.test.d.ts +11 -0
  44. package/build/connection-manager.test.d.ts.map +1 -0
  45. package/build/connection-manager.test.js +114 -0
  46. package/build/connection-manager.test.js.map +1 -0
  47. package/build/console-monitor.d.ts +150 -0
  48. package/build/console-monitor.d.ts.map +1 -0
  49. package/build/console-monitor.js +454 -0
  50. package/build/console-monitor.js.map +1 -0
  51. package/build/dashboard/bundle.js +1 -0
  52. package/build/dashboard/dashboard-client.d.ts +42 -0
  53. package/build/dashboard/dashboard-client.d.ts.map +1 -0
  54. package/build/dashboard/dashboard-client.js +184 -0
  55. package/build/dashboard/dashboard-client.js.map +1 -0
  56. package/build/dashboard/dashboard-hub.d.ts +50 -0
  57. package/build/dashboard/dashboard-hub.d.ts.map +1 -0
  58. package/build/dashboard/dashboard-hub.js +654 -0
  59. package/build/dashboard/dashboard-hub.js.map +1 -0
  60. package/build/dashboard/hub-lock.d.ts +16 -0
  61. package/build/dashboard/hub-lock.d.ts.map +1 -0
  62. package/build/dashboard/hub-lock.js +77 -0
  63. package/build/dashboard/hub-lock.js.map +1 -0
  64. package/build/dashboard/index.d.ts +25 -0
  65. package/build/dashboard/index.d.ts.map +1 -0
  66. package/build/dashboard/index.js +77 -0
  67. package/build/dashboard/index.js.map +1 -0
  68. package/build/dashboard/types.d.ts +83 -0
  69. package/build/dashboard/types.d.ts.map +1 -0
  70. package/build/dashboard/types.js +6 -0
  71. package/build/dashboard/types.js.map +1 -0
  72. package/build/debug-logger.d.ts +85 -0
  73. package/build/debug-logger.d.ts.map +1 -0
  74. package/build/debug-logger.js +195 -0
  75. package/build/debug-logger.js.map +1 -0
  76. package/build/debugger-aware-wrapper.d.ts +37 -0
  77. package/build/debugger-aware-wrapper.d.ts.map +1 -0
  78. package/build/debugger-aware-wrapper.js +128 -0
  79. package/build/debugger-aware-wrapper.js.map +1 -0
  80. package/build/dom-change-monitor.d.ts +92 -0
  81. package/build/dom-change-monitor.d.ts.map +1 -0
  82. package/build/dom-change-monitor.js +437 -0
  83. package/build/dom-change-monitor.js.map +1 -0
  84. package/build/element-collector.d.ts +16 -0
  85. package/build/element-collector.d.ts.map +1 -0
  86. package/build/element-collector.js +207 -0
  87. package/build/element-collector.js.map +1 -0
  88. package/build/error-helpers.d.ts +43 -0
  89. package/build/error-helpers.d.ts.map +1 -0
  90. package/build/error-helpers.js +143 -0
  91. package/build/error-helpers.js.map +1 -0
  92. package/build/formatters/console-formatter.d.ts +160 -0
  93. package/build/formatters/console-formatter.d.ts.map +1 -0
  94. package/build/formatters/console-formatter.js +338 -0
  95. package/build/formatters/console-formatter.js.map +1 -0
  96. package/build/helpers/parser-plugins.d.ts +44 -0
  97. package/build/helpers/parser-plugins.d.ts.map +1 -0
  98. package/build/helpers/parser-plugins.js +102 -0
  99. package/build/helpers/parser-plugins.js.map +1 -0
  100. package/build/helpers/paths.d.ts +79 -0
  101. package/build/helpers/paths.d.ts.map +1 -0
  102. package/build/helpers/paths.js +168 -0
  103. package/build/helpers/paths.js.map +1 -0
  104. package/build/helpers/process-liveness.d.ts +24 -0
  105. package/build/helpers/process-liveness.d.ts.map +1 -0
  106. package/build/helpers/process-liveness.js +36 -0
  107. package/build/helpers/process-liveness.js.map +1 -0
  108. package/build/helpers/process-liveness.test.d.ts +2 -0
  109. package/build/helpers/process-liveness.test.d.ts.map +1 -0
  110. package/build/helpers/process-liveness.test.js +40 -0
  111. package/build/helpers/process-liveness.test.js.map +1 -0
  112. package/build/helpers/sequence-tree.d.ts +27 -0
  113. package/build/helpers/sequence-tree.d.ts.map +1 -0
  114. package/build/helpers/sequence-tree.js +80 -0
  115. package/build/helpers/sequence-tree.js.map +1 -0
  116. package/build/helpers/sequence-tree.test.d.ts +2 -0
  117. package/build/helpers/sequence-tree.test.d.ts.map +1 -0
  118. package/build/helpers/sequence-tree.test.js +122 -0
  119. package/build/helpers/sequence-tree.test.js.map +1 -0
  120. package/build/index.d.ts +3 -0
  121. package/build/index.d.ts.map +1 -0
  122. package/build/index.js +2007 -0
  123. package/build/index.js.map +1 -0
  124. package/build/interaction-recorder.d.ts +214 -0
  125. package/build/interaction-recorder.d.ts.map +1 -0
  126. package/build/interaction-recorder.js +2007 -0
  127. package/build/interaction-recorder.js.map +1 -0
  128. package/build/issue-tracker.d.ts +107 -0
  129. package/build/issue-tracker.d.ts.map +1 -0
  130. package/build/issue-tracker.js +582 -0
  131. package/build/issue-tracker.js.map +1 -0
  132. package/build/issue-tracker.test.d.ts +2 -0
  133. package/build/issue-tracker.test.d.ts.map +1 -0
  134. package/build/issue-tracker.test.js +88 -0
  135. package/build/issue-tracker.test.js.map +1 -0
  136. package/build/launch-chrome-port.test.d.ts +14 -0
  137. package/build/launch-chrome-port.test.d.ts.map +1 -0
  138. package/build/launch-chrome-port.test.js +97 -0
  139. package/build/launch-chrome-port.test.js.map +1 -0
  140. package/build/log-processor/orchestrator.d.ts +32 -0
  141. package/build/log-processor/orchestrator.d.ts.map +1 -0
  142. package/build/log-processor/orchestrator.js +27 -0
  143. package/build/log-processor/orchestrator.js.map +1 -0
  144. package/build/logpoint-execution-tracker.d.ts +57 -0
  145. package/build/logpoint-execution-tracker.d.ts.map +1 -0
  146. package/build/logpoint-execution-tracker.js +112 -0
  147. package/build/logpoint-execution-tracker.js.map +1 -0
  148. package/build/mcp-supervisor.d.ts +3 -0
  149. package/build/mcp-supervisor.d.ts.map +1 -0
  150. package/build/mcp-supervisor.js +211 -0
  151. package/build/mcp-supervisor.js.map +1 -0
  152. package/build/messages.d.ts +165 -0
  153. package/build/messages.d.ts.map +1 -0
  154. package/build/messages.js +574 -0
  155. package/build/messages.js.map +1 -0
  156. package/build/network-monitor.d.ts +172 -0
  157. package/build/network-monitor.d.ts.map +1 -0
  158. package/build/network-monitor.js +350 -0
  159. package/build/network-monitor.js.map +1 -0
  160. package/build/overlays.d.ts +49 -0
  161. package/build/overlays.d.ts.map +1 -0
  162. package/build/overlays.js +409 -0
  163. package/build/overlays.js.map +1 -0
  164. package/build/persistent-profiles.test.d.ts +15 -0
  165. package/build/persistent-profiles.test.d.ts.map +1 -0
  166. package/build/persistent-profiles.test.js +470 -0
  167. package/build/persistent-profiles.test.js.map +1 -0
  168. package/build/port-reserver.d.ts +32 -0
  169. package/build/port-reserver.d.ts.map +1 -0
  170. package/build/port-reserver.js +118 -0
  171. package/build/port-reserver.js.map +1 -0
  172. package/build/puppeteer-manager.d.ts +47 -0
  173. package/build/puppeteer-manager.d.ts.map +1 -0
  174. package/build/puppeteer-manager.js +116 -0
  175. package/build/puppeteer-manager.js.map +1 -0
  176. package/build/recording-coverage.test.d.ts +12 -0
  177. package/build/recording-coverage.test.d.ts.map +1 -0
  178. package/build/recording-coverage.test.js +72 -0
  179. package/build/recording-coverage.test.js.map +1 -0
  180. package/build/reference-validator.d.ts +47 -0
  181. package/build/reference-validator.d.ts.map +1 -0
  182. package/build/reference-validator.js +86 -0
  183. package/build/reference-validator.js.map +1 -0
  184. package/build/reference-validator.test.d.ts +5 -0
  185. package/build/reference-validator.test.d.ts.map +1 -0
  186. package/build/reference-validator.test.js +243 -0
  187. package/build/reference-validator.test.js.map +1 -0
  188. package/build/replay-cursor.d.ts +27 -0
  189. package/build/replay-cursor.d.ts.map +1 -0
  190. package/build/replay-cursor.js +240 -0
  191. package/build/replay-cursor.js.map +1 -0
  192. package/build/runners/docker-compose-runner.d.ts +69 -0
  193. package/build/runners/docker-compose-runner.d.ts.map +1 -0
  194. package/build/runners/docker-compose-runner.js +438 -0
  195. package/build/runners/docker-compose-runner.js.map +1 -0
  196. package/build/runners/docker-runner.d.ts +65 -0
  197. package/build/runners/docker-runner.d.ts.map +1 -0
  198. package/build/runners/docker-runner.js +414 -0
  199. package/build/runners/docker-runner.js.map +1 -0
  200. package/build/runners/index.d.ts +19 -0
  201. package/build/runners/index.d.ts.map +1 -0
  202. package/build/runners/index.js +35 -0
  203. package/build/runners/index.js.map +1 -0
  204. package/build/runners/native-runner.d.ts +95 -0
  205. package/build/runners/native-runner.d.ts.map +1 -0
  206. package/build/runners/native-runner.js +370 -0
  207. package/build/runners/native-runner.js.map +1 -0
  208. package/build/runners/types.d.ts +147 -0
  209. package/build/runners/types.d.ts.map +1 -0
  210. package/build/runners/types.js +25 -0
  211. package/build/runners/types.js.map +1 -0
  212. package/build/self-restart.d.ts +12 -0
  213. package/build/self-restart.d.ts.map +1 -0
  214. package/build/self-restart.js +41 -0
  215. package/build/self-restart.js.map +1 -0
  216. package/build/self-restart.test.d.ts +2 -0
  217. package/build/self-restart.test.d.ts.map +1 -0
  218. package/build/self-restart.test.js +34 -0
  219. package/build/self-restart.test.js.map +1 -0
  220. package/build/server-claims.d.ts +161 -0
  221. package/build/server-claims.d.ts.map +1 -0
  222. package/build/server-claims.js +382 -0
  223. package/build/server-claims.js.map +1 -0
  224. package/build/server-claims.test.d.ts +2 -0
  225. package/build/server-claims.test.d.ts.map +1 -0
  226. package/build/server-claims.test.js +197 -0
  227. package/build/server-claims.test.js.map +1 -0
  228. package/build/server-manager.d.ts +438 -0
  229. package/build/server-manager.d.ts.map +1 -0
  230. package/build/server-manager.js +1674 -0
  231. package/build/server-manager.js.map +1 -0
  232. package/build/server-manager.test.d.ts +17 -0
  233. package/build/server-manager.test.d.ts.map +1 -0
  234. package/build/server-manager.test.js +122 -0
  235. package/build/server-manager.test.js.map +1 -0
  236. package/build/server-ownership.test.d.ts +2 -0
  237. package/build/server-ownership.test.d.ts.map +1 -0
  238. package/build/server-ownership.test.js +238 -0
  239. package/build/server-ownership.test.js.map +1 -0
  240. package/build/server-watcher.d.ts +21 -0
  241. package/build/server-watcher.d.ts.map +1 -0
  242. package/build/server-watcher.js +105 -0
  243. package/build/server-watcher.js.map +1 -0
  244. package/build/session-detector.d.ts +47 -0
  245. package/build/session-detector.d.ts.map +1 -0
  246. package/build/session-detector.js +229 -0
  247. package/build/session-detector.js.map +1 -0
  248. package/build/session-detector.test.d.ts +9 -0
  249. package/build/session-detector.test.d.ts.map +1 -0
  250. package/build/session-detector.test.js +45 -0
  251. package/build/session-detector.test.js.map +1 -0
  252. package/build/sourcemap-handler.d.ts +114 -0
  253. package/build/sourcemap-handler.d.ts.map +1 -0
  254. package/build/sourcemap-handler.js +479 -0
  255. package/build/sourcemap-handler.js.map +1 -0
  256. package/build/supervisor/child-manager.d.ts +43 -0
  257. package/build/supervisor/child-manager.d.ts.map +1 -0
  258. package/build/supervisor/child-manager.js +148 -0
  259. package/build/supervisor/child-manager.js.map +1 -0
  260. package/build/supervisor/child-manager.test.d.ts +2 -0
  261. package/build/supervisor/child-manager.test.d.ts.map +1 -0
  262. package/build/supervisor/child-manager.test.js +107 -0
  263. package/build/supervisor/child-manager.test.js.map +1 -0
  264. package/build/supervisor/client-watcher.d.ts +48 -0
  265. package/build/supervisor/client-watcher.d.ts.map +1 -0
  266. package/build/supervisor/client-watcher.js +186 -0
  267. package/build/supervisor/client-watcher.js.map +1 -0
  268. package/build/supervisor/client-watcher.test.d.ts +2 -0
  269. package/build/supervisor/client-watcher.test.d.ts.map +1 -0
  270. package/build/supervisor/client-watcher.test.js +121 -0
  271. package/build/supervisor/client-watcher.test.js.map +1 -0
  272. package/build/supervisor/idle-config.d.ts +30 -0
  273. package/build/supervisor/idle-config.d.ts.map +1 -0
  274. package/build/supervisor/idle-config.js +76 -0
  275. package/build/supervisor/idle-config.js.map +1 -0
  276. package/build/supervisor/idle-config.test.d.ts +2 -0
  277. package/build/supervisor/idle-config.test.d.ts.map +1 -0
  278. package/build/supervisor/idle-config.test.js +119 -0
  279. package/build/supervisor/idle-config.test.js.map +1 -0
  280. package/build/supervisor/ndjson-reader.d.ts +47 -0
  281. package/build/supervisor/ndjson-reader.d.ts.map +1 -0
  282. package/build/supervisor/ndjson-reader.js +75 -0
  283. package/build/supervisor/ndjson-reader.js.map +1 -0
  284. package/build/supervisor/ndjson-reader.test.d.ts +2 -0
  285. package/build/supervisor/ndjson-reader.test.d.ts.map +1 -0
  286. package/build/supervisor/ndjson-reader.test.js +92 -0
  287. package/build/supervisor/ndjson-reader.test.js.map +1 -0
  288. package/build/supervisor/pidfile.d.ts +11 -0
  289. package/build/supervisor/pidfile.d.ts.map +1 -0
  290. package/build/supervisor/pidfile.js +29 -0
  291. package/build/supervisor/pidfile.js.map +1 -0
  292. package/build/supervisor/pidfile.test.d.ts +8 -0
  293. package/build/supervisor/pidfile.test.d.ts.map +1 -0
  294. package/build/supervisor/pidfile.test.js +46 -0
  295. package/build/supervisor/pidfile.test.js.map +1 -0
  296. package/build/supervisor/restart-coordinator.d.ts +73 -0
  297. package/build/supervisor/restart-coordinator.d.ts.map +1 -0
  298. package/build/supervisor/restart-coordinator.js +300 -0
  299. package/build/supervisor/restart-coordinator.js.map +1 -0
  300. package/build/supervisor/restart-coordinator.test.d.ts +2 -0
  301. package/build/supervisor/restart-coordinator.test.d.ts.map +1 -0
  302. package/build/supervisor/restart-coordinator.test.js +434 -0
  303. package/build/supervisor/restart-coordinator.test.js.map +1 -0
  304. package/build/test-support/fake-execute-tool-call.d.ts +11 -0
  305. package/build/test-support/fake-execute-tool-call.d.ts.map +1 -0
  306. package/build/test-support/fake-execute-tool-call.js +19 -0
  307. package/build/test-support/fake-execute-tool-call.js.map +1 -0
  308. package/build/tool-error.d.ts +14 -0
  309. package/build/tool-error.d.ts.map +1 -0
  310. package/build/tool-error.js +18 -0
  311. package/build/tool-error.js.map +1 -0
  312. package/build/tool-response.d.ts +293 -0
  313. package/build/tool-response.d.ts.map +1 -0
  314. package/build/tool-response.js +365 -0
  315. package/build/tool-response.js.map +1 -0
  316. package/build/tools/assert-tools.d.ts +62 -0
  317. package/build/tools/assert-tools.d.ts.map +1 -0
  318. package/build/tools/assert-tools.js +330 -0
  319. package/build/tools/assert-tools.js.map +1 -0
  320. package/build/tools/breakpoint-await-abort.test.d.ts +2 -0
  321. package/build/tools/breakpoint-await-abort.test.d.ts.map +1 -0
  322. package/build/tools/breakpoint-await-abort.test.js +124 -0
  323. package/build/tools/breakpoint-await-abort.test.js.map +1 -0
  324. package/build/tools/breakpoint-tools.d.ts +99 -0
  325. package/build/tools/breakpoint-tools.d.ts.map +1 -0
  326. package/build/tools/breakpoint-tools.js +1197 -0
  327. package/build/tools/breakpoint-tools.js.map +1 -0
  328. package/build/tools/config-tools.d.ts +58 -0
  329. package/build/tools/config-tools.d.ts.map +1 -0
  330. package/build/tools/config-tools.js +180 -0
  331. package/build/tools/config-tools.js.map +1 -0
  332. package/build/tools/connection-routing.test.d.ts +12 -0
  333. package/build/tools/connection-routing.test.d.ts.map +1 -0
  334. package/build/tools/connection-routing.test.js +206 -0
  335. package/build/tools/connection-routing.test.js.map +1 -0
  336. package/build/tools/console-tools.d.ts +84 -0
  337. package/build/tools/console-tools.d.ts.map +1 -0
  338. package/build/tools/console-tools.js +241 -0
  339. package/build/tools/console-tools.js.map +1 -0
  340. package/build/tools/content-tools.d.ts +74 -0
  341. package/build/tools/content-tools.d.ts.map +1 -0
  342. package/build/tools/content-tools.js +582 -0
  343. package/build/tools/content-tools.js.map +1 -0
  344. package/build/tools/dashboard-tools.d.ts +38 -0
  345. package/build/tools/dashboard-tools.d.ts.map +1 -0
  346. package/build/tools/dashboard-tools.js +123 -0
  347. package/build/tools/dashboard-tools.js.map +1 -0
  348. package/build/tools/dom-tools.d.ts +41 -0
  349. package/build/tools/dom-tools.d.ts.map +1 -0
  350. package/build/tools/dom-tools.js +277 -0
  351. package/build/tools/dom-tools.js.map +1 -0
  352. package/build/tools/download-tools.d.ts +55 -0
  353. package/build/tools/download-tools.d.ts.map +1 -0
  354. package/build/tools/download-tools.js +280 -0
  355. package/build/tools/download-tools.js.map +1 -0
  356. package/build/tools/execution-tools.d.ts +40 -0
  357. package/build/tools/execution-tools.d.ts.map +1 -0
  358. package/build/tools/execution-tools.js +121 -0
  359. package/build/tools/execution-tools.js.map +1 -0
  360. package/build/tools/input-abort.test.d.ts +2 -0
  361. package/build/tools/input-abort.test.d.ts.map +1 -0
  362. package/build/tools/input-abort.test.js +227 -0
  363. package/build/tools/input-abort.test.js.map +1 -0
  364. package/build/tools/input-ambiguous-selector.test.d.ts +2 -0
  365. package/build/tools/input-ambiguous-selector.test.d.ts.map +1 -0
  366. package/build/tools/input-ambiguous-selector.test.js +34 -0
  367. package/build/tools/input-ambiguous-selector.test.js.map +1 -0
  368. package/build/tools/input-tools.d.ts +168 -0
  369. package/build/tools/input-tools.d.ts.map +1 -0
  370. package/build/tools/input-tools.js +1397 -0
  371. package/build/tools/input-tools.js.map +1 -0
  372. package/build/tools/inspection-tools.d.ts +112 -0
  373. package/build/tools/inspection-tools.d.ts.map +1 -0
  374. package/build/tools/inspection-tools.js +637 -0
  375. package/build/tools/inspection-tools.js.map +1 -0
  376. package/build/tools/interpolation.d.ts +30 -0
  377. package/build/tools/interpolation.d.ts.map +1 -0
  378. package/build/tools/interpolation.js +143 -0
  379. package/build/tools/interpolation.js.map +1 -0
  380. package/build/tools/issues-abort-hygiene.test.d.ts +2 -0
  381. package/build/tools/issues-abort-hygiene.test.d.ts.map +1 -0
  382. package/build/tools/issues-abort-hygiene.test.js +79 -0
  383. package/build/tools/issues-abort-hygiene.test.js.map +1 -0
  384. package/build/tools/issues-tools.d.ts +98 -0
  385. package/build/tools/issues-tools.d.ts.map +1 -0
  386. package/build/tools/issues-tools.js +821 -0
  387. package/build/tools/issues-tools.js.map +1 -0
  388. package/build/tools/issues-tools.test.d.ts +8 -0
  389. package/build/tools/issues-tools.test.d.ts.map +1 -0
  390. package/build/tools/issues-tools.test.js +184 -0
  391. package/build/tools/issues-tools.test.js.map +1 -0
  392. package/build/tools/modal-tools.d.ts +73 -0
  393. package/build/tools/modal-tools.d.ts.map +1 -0
  394. package/build/tools/modal-tools.js +161 -0
  395. package/build/tools/modal-tools.js.map +1 -0
  396. package/build/tools/network-tools.d.ts +72 -0
  397. package/build/tools/network-tools.d.ts.map +1 -0
  398. package/build/tools/network-tools.js +432 -0
  399. package/build/tools/network-tools.js.map +1 -0
  400. package/build/tools/page-tools.d.ts +78 -0
  401. package/build/tools/page-tools.d.ts.map +1 -0
  402. package/build/tools/page-tools.js +255 -0
  403. package/build/tools/page-tools.js.map +1 -0
  404. package/build/tools/plugin-tools.d.ts +16 -0
  405. package/build/tools/plugin-tools.d.ts.map +1 -0
  406. package/build/tools/plugin-tools.js +17 -0
  407. package/build/tools/plugin-tools.js.map +1 -0
  408. package/build/tools/replay-abort.test.d.ts +2 -0
  409. package/build/tools/replay-abort.test.d.ts.map +1 -0
  410. package/build/tools/replay-abort.test.js +259 -0
  411. package/build/tools/replay-abort.test.js.map +1 -0
  412. package/build/tools/replay-add-conditional.test.d.ts +2 -0
  413. package/build/tools/replay-add-conditional.test.d.ts.map +1 -0
  414. package/build/tools/replay-add-conditional.test.js +205 -0
  415. package/build/tools/replay-add-conditional.test.js.map +1 -0
  416. package/build/tools/replay-background-run.test.d.ts +2 -0
  417. package/build/tools/replay-background-run.test.d.ts.map +1 -0
  418. package/build/tools/replay-background-run.test.js +176 -0
  419. package/build/tools/replay-background-run.test.js.map +1 -0
  420. package/build/tools/replay-capture-variables.test.d.ts +2 -0
  421. package/build/tools/replay-capture-variables.test.d.ts.map +1 -0
  422. package/build/tools/replay-capture-variables.test.js +331 -0
  423. package/build/tools/replay-capture-variables.test.js.map +1 -0
  424. package/build/tools/replay-conditional-idb-and-launch.test.d.ts +11 -0
  425. package/build/tools/replay-conditional-idb-and-launch.test.d.ts.map +1 -0
  426. package/build/tools/replay-conditional-idb-and-launch.test.js +429 -0
  427. package/build/tools/replay-conditional-idb-and-launch.test.js.map +1 -0
  428. package/build/tools/replay-conditional-timeout.test.d.ts +14 -0
  429. package/build/tools/replay-conditional-timeout.test.d.ts.map +1 -0
  430. package/build/tools/replay-conditional-timeout.test.js +126 -0
  431. package/build/tools/replay-conditional-timeout.test.js.map +1 -0
  432. package/build/tools/replay-declare.test.d.ts +2 -0
  433. package/build/tools/replay-declare.test.d.ts.map +1 -0
  434. package/build/tools/replay-declare.test.js +106 -0
  435. package/build/tools/replay-declare.test.js.map +1 -0
  436. package/build/tools/replay-declared-browser-cleanup.test.d.ts +2 -0
  437. package/build/tools/replay-declared-browser-cleanup.test.d.ts.map +1 -0
  438. package/build/tools/replay-declared-browser-cleanup.test.js +103 -0
  439. package/build/tools/replay-declared-browser-cleanup.test.js.map +1 -0
  440. package/build/tools/replay-declared-profile.test.d.ts +2 -0
  441. package/build/tools/replay-declared-profile.test.d.ts.map +1 -0
  442. package/build/tools/replay-declared-profile.test.js +116 -0
  443. package/build/tools/replay-declared-profile.test.js.map +1 -0
  444. package/build/tools/replay-executor.d.ts +556 -0
  445. package/build/tools/replay-executor.d.ts.map +1 -0
  446. package/build/tools/replay-executor.js +2347 -0
  447. package/build/tools/replay-executor.js.map +1 -0
  448. package/build/tools/replay-folder-save.test.d.ts +2 -0
  449. package/build/tools/replay-folder-save.test.d.ts.map +1 -0
  450. package/build/tools/replay-folder-save.test.js +63 -0
  451. package/build/tools/replay-folder-save.test.js.map +1 -0
  452. package/build/tools/replay-formatters.d.ts +148 -0
  453. package/build/tools/replay-formatters.d.ts.map +1 -0
  454. package/build/tools/replay-formatters.js +856 -0
  455. package/build/tools/replay-formatters.js.map +1 -0
  456. package/build/tools/replay-kill-chrome-on-finish.test.d.ts +2 -0
  457. package/build/tools/replay-kill-chrome-on-finish.test.d.ts.map +1 -0
  458. package/build/tools/replay-kill-chrome-on-finish.test.js +175 -0
  459. package/build/tools/replay-kill-chrome-on-finish.test.js.map +1 -0
  460. package/build/tools/replay-multi-connection.test.d.ts +2 -0
  461. package/build/tools/replay-multi-connection.test.d.ts.map +1 -0
  462. package/build/tools/replay-multi-connection.test.js +547 -0
  463. package/build/tools/replay-multi-connection.test.js.map +1 -0
  464. package/build/tools/replay-output-and-record-options.test.d.ts +2 -0
  465. package/build/tools/replay-output-and-record-options.test.d.ts.map +1 -0
  466. package/build/tools/replay-output-and-record-options.test.js +240 -0
  467. package/build/tools/replay-output-and-record-options.test.js.map +1 -0
  468. package/build/tools/replay-production-error-shape.test.d.ts +7 -0
  469. package/build/tools/replay-production-error-shape.test.d.ts.map +1 -0
  470. package/build/tools/replay-production-error-shape.test.js +93 -0
  471. package/build/tools/replay-production-error-shape.test.js.map +1 -0
  472. package/build/tools/replay-rebase.test.d.ts +2 -0
  473. package/build/tools/replay-rebase.test.d.ts.map +1 -0
  474. package/build/tools/replay-rebase.test.js +58 -0
  475. package/build/tools/replay-rebase.test.js.map +1 -0
  476. package/build/tools/replay-retry-classification.test.d.ts +9 -0
  477. package/build/tools/replay-retry-classification.test.d.ts.map +1 -0
  478. package/build/tools/replay-retry-classification.test.js +57 -0
  479. package/build/tools/replay-retry-classification.test.js.map +1 -0
  480. package/build/tools/replay-run-registry.d.ts +55 -0
  481. package/build/tools/replay-run-registry.d.ts.map +1 -0
  482. package/build/tools/replay-run-registry.js +65 -0
  483. package/build/tools/replay-run-registry.js.map +1 -0
  484. package/build/tools/replay-sequence-reload.test.d.ts +2 -0
  485. package/build/tools/replay-sequence-reload.test.d.ts.map +1 -0
  486. package/build/tools/replay-sequence-reload.test.js +82 -0
  487. package/build/tools/replay-sequence-reload.test.js.map +1 -0
  488. package/build/tools/replay-socket-scope.test.d.ts +2 -0
  489. package/build/tools/replay-socket-scope.test.d.ts.map +1 -0
  490. package/build/tools/replay-socket-scope.test.js +75 -0
  491. package/build/tools/replay-socket-scope.test.js.map +1 -0
  492. package/build/tools/replay-step-connection.test.d.ts +2 -0
  493. package/build/tools/replay-step-connection.test.d.ts.map +1 -0
  494. package/build/tools/replay-step-connection.test.js +292 -0
  495. package/build/tools/replay-step-connection.test.js.map +1 -0
  496. package/build/tools/replay-step-timeout.test.d.ts +2 -0
  497. package/build/tools/replay-step-timeout.test.d.ts.map +1 -0
  498. package/build/tools/replay-step-timeout.test.js +204 -0
  499. package/build/tools/replay-step-timeout.test.js.map +1 -0
  500. package/build/tools/replay-tags.test.d.ts +2 -0
  501. package/build/tools/replay-tags.test.d.ts.map +1 -0
  502. package/build/tools/replay-tags.test.js +99 -0
  503. package/build/tools/replay-tags.test.js.map +1 -0
  504. package/build/tools/replay-teardown-and-foreach.test.d.ts +13 -0
  505. package/build/tools/replay-teardown-and-foreach.test.d.ts.map +1 -0
  506. package/build/tools/replay-teardown-and-foreach.test.js +318 -0
  507. package/build/tools/replay-teardown-and-foreach.test.js.map +1 -0
  508. package/build/tools/replay-tool-name-validation.test.d.ts +2 -0
  509. package/build/tools/replay-tool-name-validation.test.d.ts.map +1 -0
  510. package/build/tools/replay-tool-name-validation.test.js +280 -0
  511. package/build/tools/replay-tool-name-validation.test.js.map +1 -0
  512. package/build/tools/replay-tools.d.ts +288 -0
  513. package/build/tools/replay-tools.d.ts.map +1 -0
  514. package/build/tools/replay-tools.js +2994 -0
  515. package/build/tools/replay-tools.js.map +1 -0
  516. package/build/tools/request-abort.test.d.ts +2 -0
  517. package/build/tools/request-abort.test.d.ts.map +1 -0
  518. package/build/tools/request-abort.test.js +130 -0
  519. package/build/tools/request-abort.test.js.map +1 -0
  520. package/build/tools/request-tools.d.ts +56 -0
  521. package/build/tools/request-tools.d.ts.map +1 -0
  522. package/build/tools/request-tools.js +174 -0
  523. package/build/tools/request-tools.js.map +1 -0
  524. package/build/tools/screenshot-tools.d.ts +135 -0
  525. package/build/tools/screenshot-tools.d.ts.map +1 -0
  526. package/build/tools/screenshot-tools.js +636 -0
  527. package/build/tools/screenshot-tools.js.map +1 -0
  528. package/build/tools/server-tools.d.ts +88 -0
  529. package/build/tools/server-tools.d.ts.map +1 -0
  530. package/build/tools/server-tools.js +485 -0
  531. package/build/tools/server-tools.js.map +1 -0
  532. package/build/tools/source-tools.d.ts +46 -0
  533. package/build/tools/source-tools.d.ts.map +1 -0
  534. package/build/tools/source-tools.js +47 -0
  535. package/build/tools/source-tools.js.map +1 -0
  536. package/build/tools/storage-tools.d.ts +141 -0
  537. package/build/tools/storage-tools.d.ts.map +1 -0
  538. package/build/tools/storage-tools.js +894 -0
  539. package/build/tools/storage-tools.js.map +1 -0
  540. package/build/tools/storage-tools.test.d.ts +13 -0
  541. package/build/tools/storage-tools.test.d.ts.map +1 -0
  542. package/build/tools/storage-tools.test.js +707 -0
  543. package/build/tools/storage-tools.test.js.map +1 -0
  544. package/build/tools/tab-tools.d.ts +42 -0
  545. package/build/tools/tab-tools.d.ts.map +1 -0
  546. package/build/tools/tab-tools.js +296 -0
  547. package/build/tools/tab-tools.js.map +1 -0
  548. package/build/tools/wait-tools.d.ts +85 -0
  549. package/build/tools/wait-tools.d.ts.map +1 -0
  550. package/build/tools/wait-tools.js +236 -0
  551. package/build/tools/wait-tools.js.map +1 -0
  552. package/build/tools/wait-tools.test.d.ts +9 -0
  553. package/build/tools/wait-tools.test.d.ts.map +1 -0
  554. package/build/tools/wait-tools.test.js +193 -0
  555. package/build/tools/wait-tools.test.js.map +1 -0
  556. package/build/types.d.ts +133 -0
  557. package/build/types.d.ts.map +1 -0
  558. package/build/types.js +5 -0
  559. package/build/types.js.map +1 -0
  560. package/build/ui-verifier.d.ts +88 -0
  561. package/build/ui-verifier.d.ts.map +1 -0
  562. package/build/ui-verifier.js +540 -0
  563. package/build/ui-verifier.js.map +1 -0
  564. package/build/utils/abort.d.ts +68 -0
  565. package/build/utils/abort.d.ts.map +1 -0
  566. package/build/utils/abort.js +159 -0
  567. package/build/utils/abort.js.map +1 -0
  568. package/build/utils/abort.test.d.ts +2 -0
  569. package/build/utils/abort.test.d.ts.map +1 -0
  570. package/build/utils/abort.test.js +174 -0
  571. package/build/utils/abort.test.js.map +1 -0
  572. package/build/utils/modal-detection-core.d.ts +150 -0
  573. package/build/utils/modal-detection-core.d.ts.map +1 -0
  574. package/build/utils/modal-detection-core.js +332 -0
  575. package/build/utils/modal-detection-core.js.map +1 -0
  576. package/build/utils/modal-detection-core.test.d.ts +5 -0
  577. package/build/utils/modal-detection-core.test.d.ts.map +1 -0
  578. package/build/utils/modal-detection-core.test.js +492 -0
  579. package/build/utils/modal-detection-core.test.js.map +1 -0
  580. package/build/utils/modal-detector.d.ts +29 -0
  581. package/build/utils/modal-detector.d.ts.map +1 -0
  582. package/build/utils/modal-detector.js +281 -0
  583. package/build/utils/modal-detector.js.map +1 -0
  584. package/build/utils/modal-dismissal.d.ts +32 -0
  585. package/build/utils/modal-dismissal.d.ts.map +1 -0
  586. package/build/utils/modal-dismissal.js +190 -0
  587. package/build/utils/modal-dismissal.js.map +1 -0
  588. package/build/utils/port-check.d.ts +31 -0
  589. package/build/utils/port-check.d.ts.map +1 -0
  590. package/build/utils/port-check.js +87 -0
  591. package/build/utils/port-check.js.map +1 -0
  592. package/build/utils/port-check.test.d.ts +2 -0
  593. package/build/utils/port-check.test.d.ts.map +1 -0
  594. package/build/utils/port-check.test.js +66 -0
  595. package/build/utils/port-check.test.js.map +1 -0
  596. package/build/utils/selector-resolver.d.ts +66 -0
  597. package/build/utils/selector-resolver.d.ts.map +1 -0
  598. package/build/utils/selector-resolver.js +200 -0
  599. package/build/utils/selector-resolver.js.map +1 -0
  600. package/build/validation-helpers.d.ts +41 -0
  601. package/build/validation-helpers.d.ts.map +1 -0
  602. package/build/validation-helpers.js +236 -0
  603. package/build/validation-helpers.js.map +1 -0
  604. package/build/window-sizing.d.ts +26 -0
  605. package/build/window-sizing.d.ts.map +1 -0
  606. package/build/window-sizing.js +87 -0
  607. package/build/window-sizing.js.map +1 -0
  608. package/build/window-sizing.test.d.ts +8 -0
  609. package/build/window-sizing.test.d.ts.map +1 -0
  610. package/build/window-sizing.test.js +113 -0
  611. package/build/window-sizing.test.js.map +1 -0
  612. package/docs/README.md +74 -0
  613. package/docs/automation.md +562 -0
  614. package/docs/debugging.md +229 -0
  615. package/docs/installation.md +133 -0
  616. package/docs/instructions.md +227 -0
  617. package/docs/mcp-instructions.md +15 -0
  618. package/docs/message-system.md +327 -0
  619. package/docs/messages.md +3480 -0
  620. package/docs/parser-plugins.md +132 -0
  621. package/docs/replay.md +1411 -0
  622. package/docs/troubleshooting.md +272 -0
  623. package/docs/working_with_llm_notes.md +5 -0
  624. package/package.json +87 -0
  625. package/skills/devharness/SKILL.md +195 -0
  626. package/skills/devharness/references/sequences.md +613 -0
  627. package/skills/devharness/references/tool-categories.md +99 -0
@@ -0,0 +1,432 @@
1
+ /**
2
+ * Connection Manager
3
+ * Manages multiple debugger connections (Chrome, Node.js, etc.)
4
+ */
5
+ export class ConnectionManager {
6
+ connections = new Map();
7
+ browsers = new Map(); // Key: "host:port"
8
+ activeConnectionId = null;
9
+ connectionCounter = 0;
10
+ chromeLauncher;
11
+ /**
12
+ * Set the Chrome launcher instance for automatic cleanup
13
+ */
14
+ setChromeLauncher(launcher) {
15
+ this.chromeLauncher = launcher;
16
+ }
17
+ /**
18
+ * Create a new connection (tab)
19
+ */
20
+ createConnection(cdpManager, puppeteerManager, consoleMonitor, networkMonitor, host = 'localhost', port = 9222, reference, pageIndex) {
21
+ const id = `conn-${++this.connectionCounter}`;
22
+ const type = cdpManager.getRuntimeType();
23
+ const now = Date.now();
24
+ const connection = {
25
+ id,
26
+ type,
27
+ cdpManager,
28
+ puppeteerManager,
29
+ consoleMonitor,
30
+ networkMonitor,
31
+ host,
32
+ port,
33
+ createdAt: now,
34
+ lastActivityAt: now,
35
+ reference,
36
+ pageIndex,
37
+ };
38
+ this.connections.set(id, connection);
39
+ // Track browser instance
40
+ const browserKey = `${host}:${port}`;
41
+ if (!this.browsers.has(browserKey)) {
42
+ this.browsers.set(browserKey, {
43
+ host,
44
+ port,
45
+ connectionIds: [id],
46
+ });
47
+ }
48
+ else {
49
+ this.browsers.get(browserKey).connectionIds.push(id);
50
+ }
51
+ // Set as active if it's the first connection
52
+ if (this.connections.size === 1) {
53
+ this.activeConnectionId = id;
54
+ }
55
+ return id;
56
+ }
57
+ /**
58
+ * Check if a browser instance exists at this host:port
59
+ */
60
+ hasBrowser(host, port) {
61
+ const browserKey = `${host}:${port}`;
62
+ return this.browsers.has(browserKey);
63
+ }
64
+ /**
65
+ * Get all connections for a specific browser
66
+ */
67
+ getConnectionsForBrowser(host, port) {
68
+ const browserKey = `${host}:${port}`;
69
+ const browser = this.browsers.get(browserKey);
70
+ if (!browser) {
71
+ return [];
72
+ }
73
+ return browser.connectionIds
74
+ .map(id => this.connections.get(id))
75
+ .filter((conn) => conn !== undefined);
76
+ }
77
+ /**
78
+ * Find a connection by host/port (e.g. a Node --inspect port). Returns the
79
+ * first match if more than one connection somehow shares the same port.
80
+ */
81
+ findConnectionByPort(host, port) {
82
+ return this.getConnectionsForBrowser(host, port)[0] ?? null;
83
+ }
84
+ /**
85
+ * Get all connections
86
+ */
87
+ getAllConnections() {
88
+ return Array.from(this.connections.values());
89
+ }
90
+ /**
91
+ * Update tab reference for a connection
92
+ */
93
+ updateReference(connectionId, reference) {
94
+ const connection = this.connections.get(connectionId);
95
+ if (!connection) {
96
+ return false;
97
+ }
98
+ connection.reference = reference;
99
+ return true;
100
+ }
101
+ /**
102
+ * Get a connection by ID (or active if not specified)
103
+ */
104
+ getConnection(id) {
105
+ if (id) {
106
+ return this.connections.get(id) || null;
107
+ }
108
+ if (this.activeConnectionId) {
109
+ return this.connections.get(this.activeConnectionId) || null;
110
+ }
111
+ return null;
112
+ }
113
+ /**
114
+ * Find a connection by reference name
115
+ * Sanitizes input to match stored references (lowercase, trimmed, spaces to hyphens)
116
+ */
117
+ findConnectionByReference(reference) {
118
+ // Sanitize: lowercase, trim, spaces to hyphens
119
+ const sanitized = reference.toLowerCase().trim().replace(/\s+/g, '-');
120
+ for (const connection of this.connections.values()) {
121
+ if (connection.reference === sanitized) {
122
+ return connection;
123
+ }
124
+ }
125
+ return null;
126
+ }
127
+ /**
128
+ * Check if a connection is still alive by attempting a lightweight CDP call
129
+ * Returns false if the connection is dead or the CDP client is not responding
130
+ * Uses a short timeout to avoid hanging when Chrome is killed or page is stuck
131
+ *
132
+ * This checks at the TARGET level (specific tab), not browser level.
133
+ * When a tab is closed, the CDP connection to that target becomes invalid
134
+ * even if the browser is still running.
135
+ */
136
+ async isConnectionAlive(connection) {
137
+ try {
138
+ // Quick check: if cdpManager says not connected, it's definitely dead
139
+ if (!connection.cdpManager.isConnected()) {
140
+ return false;
141
+ }
142
+ const client = connection.cdpManager.client;
143
+ if (!client) {
144
+ return false;
145
+ }
146
+ // Check WebSocket state first - this is instant and doesn't require a round-trip
147
+ // The CDP client uses a WebSocket internally
148
+ const ws = client._ws;
149
+ if (ws && ws.readyState !== 1) { // 1 = WebSocket.OPEN
150
+ return false;
151
+ }
152
+ // Use a short timeout to avoid hanging on dead/stuck connections
153
+ const timeoutPromise = new Promise((resolve) => {
154
+ setTimeout(() => resolve(false), 1500);
155
+ });
156
+ const healthCheckPromise = (async () => {
157
+ try {
158
+ // IMPORTANT: Use Runtime.evaluate instead of Browser.getVersion
159
+ // Browser.getVersion is browser-level and works even when the tab is closed
160
+ // Runtime.evaluate is target-level and will fail if the tab is closed
161
+ // This properly detects closed tabs, not just killed Chrome processes
162
+ await client.Runtime.evaluate({ expression: '1', silent: true });
163
+ return true;
164
+ }
165
+ catch {
166
+ return false;
167
+ }
168
+ })();
169
+ return await Promise.race([healthCheckPromise, timeoutPromise]);
170
+ }
171
+ catch {
172
+ return false;
173
+ }
174
+ }
175
+ /**
176
+ * Remove a stale/dead connection from the registry without attempting cleanup operations
177
+ * Use this when the connection is known to be dead (e.g., Chrome was killed externally)
178
+ */
179
+ async removeStaleConnection(connectionId) {
180
+ const connection = this.connections.get(connectionId);
181
+ if (!connection) {
182
+ return false;
183
+ }
184
+ console.error(`[ConnectionManager] Removing stale connection: ${connection.reference || connectionId}`);
185
+ // Best-effort: let the CDP manager release its state and fire any pending
186
+ // resume callback (e.g. to un-pause port monitoring) even though the
187
+ // underlying connection is already dead - this is the more common path a
188
+ // paused-then-killed process actually gets cleaned up through (discovered
189
+ // as dead on the next tool call, rather than an explicit disconnect).
190
+ try {
191
+ await connection.cdpManager.disconnect();
192
+ }
193
+ catch (error) {
194
+ console.error(`[ConnectionManager] Error disconnecting stale cdpManager: ${error}`);
195
+ }
196
+ // Remove from browser tracking
197
+ const browserKey = `${connection.host}:${connection.port}`;
198
+ const browser = this.browsers.get(browserKey);
199
+ if (browser) {
200
+ browser.connectionIds = browser.connectionIds.filter(connId => connId !== connectionId);
201
+ if (browser.connectionIds.length === 0) {
202
+ this.browsers.delete(browserKey);
203
+ }
204
+ }
205
+ // Remove from registry
206
+ this.connections.delete(connectionId);
207
+ // Update active connection if we just removed it
208
+ if (this.activeConnectionId === connectionId) {
209
+ const remaining = Array.from(this.connections.keys());
210
+ this.activeConnectionId = remaining.length > 0 ? remaining[0] : null;
211
+ }
212
+ return true;
213
+ }
214
+ /**
215
+ * Find a connection by reference and validate it's still alive
216
+ * If the connection is dead, automatically removes it and returns null
217
+ * Use this instead of findConnectionByReference when you need to verify the connection is usable
218
+ */
219
+ async findConnectionByReferenceValidated(reference) {
220
+ const connection = this.findConnectionByReference(reference);
221
+ if (!connection) {
222
+ return null;
223
+ }
224
+ const alive = await this.isConnectionAlive(connection);
225
+ if (!alive) {
226
+ console.error(`[ConnectionManager] Connection "${connection.reference}" is dead, removing stale reference`);
227
+ await this.removeStaleConnection(connection.id);
228
+ return null;
229
+ }
230
+ return connection;
231
+ }
232
+ /**
233
+ * Get all connections
234
+ */
235
+ listConnections() {
236
+ return Array.from(this.connections.values());
237
+ }
238
+ /**
239
+ * Set the active connection
240
+ */
241
+ setActiveConnection(id) {
242
+ if (this.connections.has(id)) {
243
+ this.activeConnectionId = id;
244
+ return true;
245
+ }
246
+ return false;
247
+ }
248
+ /**
249
+ * Get the active connection ID
250
+ */
251
+ getActiveConnectionId() {
252
+ return this.activeConnectionId;
253
+ }
254
+ /**
255
+ * Close a connection (tab)
256
+ * @param options.reason - Why this connection is being closed. 'inactivity' triggers a
257
+ * last-chance activity check (see below) and tags the resulting Chrome kill correctly
258
+ * instead of it being misreported as an 'external' close.
259
+ * @param options.inactivityThresholdMs - Required when reason is 'inactivity'; used for
260
+ * the last-chance activity check.
261
+ */
262
+ async closeConnection(id, options) {
263
+ const connection = this.connections.get(id);
264
+ if (!connection) {
265
+ return false;
266
+ }
267
+ // Last-chance check for automatic inactivity sweeps only: lastActivityAt only tracks
268
+ // explicit tool calls, but the browser can still be genuinely in use via background
269
+ // console/network traffic (e.g. a logpoint firing on an interval) with no tool call in
270
+ // between. Check the monitors - which are still alive at this point - before tearing
271
+ // anything down, instead of after (by which point they'd already be destroyed below).
272
+ if (options?.reason === 'inactivity' && options.inactivityThresholdMs !== undefined) {
273
+ const stillActive = connection.networkMonitor?.hasRecentActivity(options.inactivityThresholdMs) ||
274
+ connection.consoleMonitor?.hasRecentActivity(options.inactivityThresholdMs);
275
+ if (stillActive) {
276
+ connection.lastActivityAt = Date.now();
277
+ return false;
278
+ }
279
+ }
280
+ // Stop monitoring if applicable
281
+ if (connection.puppeteerManager?.isConnected()) {
282
+ const page = connection.puppeteerManager.getPage();
283
+ connection.consoleMonitor?.stopMonitoring(page);
284
+ connection.networkMonitor?.stopMonitoring(page);
285
+ // Close the page/tab
286
+ try {
287
+ await page.close();
288
+ }
289
+ catch (error) {
290
+ console.error(`[ConnectionManager] Error closing page: ${error}`);
291
+ }
292
+ }
293
+ // Disconnect managers only for this connection. Best-effort: the underlying
294
+ // connection may already be dead (e.g. the process was killed), and we
295
+ // still need the rest of this cleanup (browser tracking, Chrome kill,
296
+ // registry removal below) to run either way.
297
+ try {
298
+ await connection.cdpManager.disconnect();
299
+ }
300
+ catch (error) {
301
+ console.error(`[ConnectionManager] Error disconnecting cdpManager for ${id}: ${error}`);
302
+ }
303
+ // Note: Don't disconnect puppeteerManager as it's shared across tabs
304
+ // Remove from browser tracking
305
+ const browserKey = `${connection.host}:${connection.port}`;
306
+ const browser = this.browsers.get(browserKey);
307
+ if (browser) {
308
+ browser.connectionIds = browser.connectionIds.filter(connId => connId !== id);
309
+ // If no more connections, remove browser entry and kill Chrome
310
+ if (browser.connectionIds.length === 0) {
311
+ this.browsers.delete(browserKey);
312
+ // Kill Chrome instance if this was the last connection to it
313
+ if (this.chromeLauncher && connection.type === 'chrome') {
314
+ try {
315
+ if (options?.reason === 'inactivity') {
316
+ this.chromeLauncher.setPendingCloseReason(connection.port, 'inactivity');
317
+ }
318
+ await this.chromeLauncher.kill(connection.port);
319
+ console.error(`[ConnectionManager] Killed Chrome on port ${connection.port} (last connection closed)`);
320
+ }
321
+ catch (error) {
322
+ console.error(`[ConnectionManager] Error killing Chrome on port ${connection.port}: ${error}`);
323
+ }
324
+ }
325
+ }
326
+ }
327
+ // Remove from registry
328
+ this.connections.delete(id);
329
+ // Update active connection if we just closed it
330
+ if (this.activeConnectionId === id) {
331
+ const remaining = Array.from(this.connections.keys());
332
+ this.activeConnectionId = remaining.length > 0 ? remaining[0] : null;
333
+ }
334
+ return true;
335
+ }
336
+ /**
337
+ * Close all connections
338
+ */
339
+ async closeAll() {
340
+ const ids = Array.from(this.connections.keys());
341
+ for (const id of ids) {
342
+ await this.closeConnection(id);
343
+ }
344
+ }
345
+ /**
346
+ * Check if there are any connections
347
+ */
348
+ hasConnections() {
349
+ return this.connections.size > 0;
350
+ }
351
+ /**
352
+ * Get connection count
353
+ */
354
+ getConnectionCount() {
355
+ return this.connections.size;
356
+ }
357
+ /**
358
+ * Update the lastActivityAt timestamp for a connection
359
+ */
360
+ updateActivity(id) {
361
+ const connection = this.connections.get(id);
362
+ if (connection) {
363
+ connection.lastActivityAt = Date.now();
364
+ }
365
+ }
366
+ /**
367
+ * Close connections that have been inactive for longer than the specified duration
368
+ * @param inactivityMs - Inactivity duration in milliseconds (default: 5 minutes)
369
+ * @returns Number of connections closed
370
+ */
371
+ async closeInactiveConnections(inactivityMs = 5 * 60 * 1000) {
372
+ const now = Date.now();
373
+ const connectionsToClose = [];
374
+ for (const [id, connection] of this.connections.entries()) {
375
+ const inactiveDuration = now - connection.lastActivityAt;
376
+ if (inactiveDuration > inactivityMs) {
377
+ connectionsToClose.push(id);
378
+ }
379
+ }
380
+ let closedCount = 0;
381
+ for (const id of connectionsToClose) {
382
+ const closed = await this.closeConnection(id, { reason: 'inactivity', inactivityThresholdMs: inactivityMs });
383
+ if (closed) {
384
+ closedCount++;
385
+ }
386
+ }
387
+ return closedCount;
388
+ }
389
+ /**
390
+ * Get list of inactive connections
391
+ * @param inactivityMs - Inactivity duration in milliseconds (default: 5 minutes)
392
+ * @returns Array of inactive connections with their info
393
+ */
394
+ getInactiveConnections(inactivityMs = 5 * 60 * 1000) {
395
+ const now = Date.now();
396
+ const inactive = [];
397
+ for (const connection of this.connections.values()) {
398
+ const inactiveDuration = now - connection.lastActivityAt;
399
+ if (inactiveDuration > inactivityMs) {
400
+ inactive.push({
401
+ id: connection.id,
402
+ reference: connection.reference,
403
+ inactiveForMs: inactiveDuration,
404
+ createdAt: connection.createdAt,
405
+ });
406
+ }
407
+ }
408
+ return inactive;
409
+ }
410
+ /**
411
+ * Get console log stats from all connections
412
+ * Returns an array of stats per connection that has new messages
413
+ */
414
+ getConsoleLogStats() {
415
+ const stats = [];
416
+ for (const connection of this.connections.values()) {
417
+ if (connection.consoleMonitor) {
418
+ const logStats = connection.consoleMonitor.getLogStats();
419
+ if (logStats.newMessages > 0) {
420
+ stats.push({
421
+ reference: connection.reference || connection.id,
422
+ newMessages: logStats.newMessages,
423
+ newErrors: logStats.newErrors,
424
+ newWarnings: logStats.newWarnings,
425
+ });
426
+ }
427
+ }
428
+ }
429
+ return stats;
430
+ }
431
+ }
432
+ //# sourceMappingURL=connection-manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection-manager.js","sourceRoot":"","sources":["../src/connection-manager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAgCH,MAAM,OAAO,iBAAiB;IACpB,WAAW,GAA4B,IAAI,GAAG,EAAE,CAAC;IACjD,QAAQ,GAAiC,IAAI,GAAG,EAAE,CAAC,CAAC,mBAAmB;IACvE,kBAAkB,GAAkB,IAAI,CAAC;IACzC,iBAAiB,GAAG,CAAC,CAAC;IACtB,cAAc,CAAkB;IAExC;;OAEG;IACH,iBAAiB,CAAC,QAAwB;QACxC,IAAI,CAAC,cAAc,GAAG,QAAQ,CAAC;IACjC,CAAC;IAED;;OAEG;IACH,gBAAgB,CACd,UAAsB,E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AO,KAAK,CAAC;IACf,CAAC;CACF"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Unit tests for ConnectionManager cleanup paths:
3
+ * - Inactivity-triggered closeConnection() correctly checks for recent
4
+ * console/network activity before tearing anything down, and tags the
5
+ * resulting Chrome kill with the right reason (not a manual close).
6
+ * - Stale/close cleanup best-effort disconnects the cdpManager even when the
7
+ * underlying connection is already dead, so a paused-then-killed process
8
+ * doesn't leave dependent state (e.g. port monitoring) stuck forever.
9
+ */
10
+ export {};
11
+ //# sourceMappingURL=connection-manager.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection-manager.test.d.ts","sourceRoot":"","sources":["../src/connection-manager.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
@@ -0,0 +1,114 @@
1
+ /**
2
+ * Unit tests for ConnectionManager cleanup paths:
3
+ * - Inactivity-triggered closeConnection() correctly checks for recent
4
+ * console/network activity before tearing anything down, and tags the
5
+ * resulting Chrome kill with the right reason (not a manual close).
6
+ * - Stale/close cleanup best-effort disconnects the cdpManager even when the
7
+ * underlying connection is already dead, so a paused-then-killed process
8
+ * doesn't leave dependent state (e.g. port monitoring) stuck forever.
9
+ */
10
+ import { describe, it, expect, vi } from 'vitest';
11
+ import { ConnectionManager } from './connection-manager.js';
12
+ function mockCdpManager(overrides = {}) {
13
+ return {
14
+ getRuntimeType: overrides.getRuntimeType ?? (() => 'chrome'),
15
+ disconnect: overrides.disconnect ?? vi.fn().mockResolvedValue(undefined),
16
+ };
17
+ }
18
+ function mockChromeLauncher() {
19
+ const calls = { setPendingCloseReason: [], kill: [] };
20
+ return {
21
+ calls,
22
+ setPendingCloseReason(port, reason) {
23
+ calls.setPendingCloseReason.push({ port, reason });
24
+ },
25
+ async kill(port) {
26
+ calls.kill.push(port);
27
+ },
28
+ };
29
+ }
30
+ describe('ConnectionManager.closeConnection - inactivity activity check', () => {
31
+ it('does not close a connection with recent console/network activity', async () => {
32
+ const cm = new ConnectionManager();
33
+ const launcher = mockChromeLauncher();
34
+ cm.setChromeLauncher(launcher);
35
+ const consoleMonitor = { hasRecentActivity: () => true };
36
+ const id = cm.createConnection(mockCdpManager(), undefined, consoleMonitor, undefined, 'localhost', 9201);
37
+ const conn = cm.getConnection(id);
38
+ conn.lastActivityAt = Date.now() - 10 * 60 * 1000;
39
+ const closed = await cm.closeConnection(id, { reason: 'inactivity', inactivityThresholdMs: 5 * 60 * 1000 });
40
+ expect(closed).toBe(false);
41
+ expect(cm.getConnection(id)).not.toBeNull();
42
+ expect(launcher.calls.kill).toHaveLength(0);
43
+ });
44
+ it('closes a genuinely idle connection and tags the Chrome kill as inactivity', async () => {
45
+ const cm = new ConnectionManager();
46
+ const launcher = mockChromeLauncher();
47
+ cm.setChromeLauncher(launcher);
48
+ const consoleMonitor = { hasRecentActivity: () => false };
49
+ const networkMonitor = { hasRecentActivity: () => false };
50
+ const id = cm.createConnection(mockCdpManager(), undefined, consoleMonitor, networkMonitor, 'localhost', 9202);
51
+ const conn = cm.getConnection(id);
52
+ conn.lastActivityAt = Date.now() - 10 * 60 * 1000;
53
+ const closed = await cm.closeConnection(id, { reason: 'inactivity', inactivityThresholdMs: 5 * 60 * 1000 });
54
+ expect(closed).toBe(true);
55
+ expect(cm.getConnection(id)).toBeNull();
56
+ expect(launcher.calls.setPendingCloseReason).toEqual([{ port: 9202, reason: 'inactivity' }]);
57
+ expect(launcher.calls.kill).toEqual([9202]);
58
+ });
59
+ it('manual close (e.g. tab close) ignores the activity check and does not tag a reason', async () => {
60
+ const cm = new ConnectionManager();
61
+ const launcher = mockChromeLauncher();
62
+ cm.setChromeLauncher(launcher);
63
+ const consoleMonitor = { hasRecentActivity: () => true }; // even with recent activity...
64
+ const id = cm.createConnection(mockCdpManager(), undefined, consoleMonitor, undefined, 'localhost', 9203);
65
+ const closed = await cm.closeConnection(id); // ...manual close (no options) should just close
66
+ expect(closed).toBe(true);
67
+ expect(launcher.calls.setPendingCloseReason).toHaveLength(0);
68
+ expect(launcher.calls.kill).toEqual([9203]);
69
+ });
70
+ it('closeInactiveConnections only counts connections actually closed', async () => {
71
+ const cm = new ConnectionManager();
72
+ const launcher = mockChromeLauncher();
73
+ cm.setChromeLauncher(launcher);
74
+ const activeConsole = { hasRecentActivity: () => true };
75
+ const idleConsole = { hasRecentActivity: () => false };
76
+ const activeId = cm.createConnection(mockCdpManager(), undefined, activeConsole, undefined, 'localhost', 9204);
77
+ const idleId = cm.createConnection(mockCdpManager(), undefined, idleConsole, undefined, 'localhost', 9205);
78
+ cm.getConnection(activeId).lastActivityAt = Date.now() - 10 * 60 * 1000;
79
+ cm.getConnection(idleId).lastActivityAt = Date.now() - 10 * 60 * 1000;
80
+ const closedCount = await cm.closeInactiveConnections(5 * 60 * 1000);
81
+ expect(closedCount).toBe(1);
82
+ expect(cm.getConnection(activeId)).not.toBeNull();
83
+ expect(cm.getConnection(idleId)).toBeNull();
84
+ });
85
+ });
86
+ describe('ConnectionManager - best-effort cdpManager.disconnect() on cleanup', () => {
87
+ it('removeStaleConnection disconnects the cdpManager', async () => {
88
+ const cm = new ConnectionManager();
89
+ const disconnect = vi.fn().mockResolvedValue(undefined);
90
+ const id = cm.createConnection(mockCdpManager({ disconnect }), undefined, undefined, undefined, 'localhost', 9206);
91
+ const removed = await cm.removeStaleConnection(id);
92
+ expect(removed).toBe(true);
93
+ expect(disconnect).toHaveBeenCalledTimes(1);
94
+ expect(cm.getConnection(id)).toBeNull();
95
+ });
96
+ it('removeStaleConnection still removes the connection if disconnect() throws', async () => {
97
+ const cm = new ConnectionManager();
98
+ const disconnect = vi.fn().mockRejectedValue(new Error('already dead'));
99
+ const id = cm.createConnection(mockCdpManager({ disconnect }), undefined, undefined, undefined, 'localhost', 9207);
100
+ const removed = await cm.removeStaleConnection(id);
101
+ expect(removed).toBe(true);
102
+ expect(cm.getConnection(id)).toBeNull();
103
+ });
104
+ it('closeConnection still cleans up if cdpManager.disconnect() throws', async () => {
105
+ const cm = new ConnectionManager();
106
+ const disconnect = vi.fn().mockRejectedValue(new Error('socket already closed'));
107
+ const id = cm.createConnection(mockCdpManager({ disconnect }), undefined, undefined, undefined, 'localhost', 9208);
108
+ const closed = await cm.closeConnection(id);
109
+ expect(closed).toBe(true);
110
+ expect(disconnect).toHaveBeenCalledTimes(1);
111
+ expect(cm.getConnection(id)).toBeNull();
112
+ });
113
+ });
114
+ //# sourceMappingURL=connection-manager.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection-manager.test.js","sourceRoot":"","sources":["../src/connection-manager.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,SAAS,cAAc,CAAC,YAGpB,EAAE;IACJ,OAAO;QACL,cAAc,EAAE,SAAS,CAAC,cAAc,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC;QAC5D,UAAU,EAAE,SAAS,CAAC,UAAU,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,SAAS,CAAC;KACzE,CAAC;AACJ,CAAC;AAED,SAAS,kBAAkB;IACzB,MAAM,KAAK,GAAG,EAAE,qBAAqB,EAAE,EAA6C,EAAE,IAAI,EAAE,EAAc,EAAE,CAAC;IAC7G,OAAO;QACL,KAAK;QACL,qBAAqB,CAAC,IAAY,EAAE,MAAc;YAChD,KAAK,CAAC,qBAAqB,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;QACrD,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,IAAY;YACrB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACxB,CAAC;KACF,CAAC;AACJ,CAAC;AAED,QAAQ,CAAC,+DAA+D,EAAE,GAAG,EAAE;IAC7E,EAAE,CAAC,kEAAkE,EA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