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,479 @@
1
+ /**
2
+ * Source Map Handler
3
+ * Handles TypeScript to JavaScript mapping for breakpoints
4
+ */
5
+ import { SourceMapConsumer } from 'source-map';
6
+ import * as fs from 'fs/promises';
7
+ import * as path from 'path';
8
+ import { debugLog } from './debug-logger.js';
9
+ // Max size limits to prevent performance issues
10
+ const MAX_INLINE_SOURCEMAP_SIZE = 1_000_000; // 1MB base64 ≈ 750KB decoded
11
+ const MAX_FILE_SOURCEMAP_SIZE = 10_000_000; // 10MB for file-based source maps
12
+ export class SourceMapHandler {
13
+ sourceMaps = new Map();
14
+ pendingSourceMaps = new Map(); // scriptUrl → sourceMapURL (lazy loading)
15
+ loadingPromises = new Map(); // prevent concurrent loads with proper deduplication
16
+ lastErrors = []; // track recent errors for debugging
17
+ clearing = false; // flag to prevent operations during clear
18
+ /**
19
+ * Register a source map URL for lazy loading (does not load immediately)
20
+ */
21
+ registerSourceMap(scriptUrl, sourceMapURL) {
22
+ if (this.clearing)
23
+ return;
24
+ this.pendingSourceMaps.set(scriptUrl, sourceMapURL);
25
+ }
26
+ /**
27
+ * Load a source map from a file (with size limit)
28
+ */
29
+ async loadSourceMap(generatedFilePath) {
30
+ if (this.clearing)
31
+ return;
32
+ try {
33
+ const mapPath = `${generatedFilePath}.map`;
34
+ // Check file size before reading
35
+ const stats = await fs.stat(mapPath);
36
+ if (stats.size > MAX_FILE_SOURCEMAP_SIZE) {
37
+ this.recordError(generatedFilePath, `Source map too large: ${stats.size} bytes (max ${MAX_FILE_SOURCEMAP_SIZE})`);
38
+ return;
39
+ }
40
+ const mapContent = await fs.readFile(mapPath, 'utf-8');
41
+ const rawSourceMap = JSON.parse(mapContent);
42
+ const consumer = await new SourceMapConsumer(rawSourceMap);
43
+ if (!this.clearing) {
44
+ this.sourceMaps.set(generatedFilePath, consumer);
45
+ }
46
+ else {
47
+ consumer.destroy();
48
+ }
49
+ }
50
+ catch (error) {
51
+ this.recordError(generatedFilePath, String(error));
52
+ // Fire-and-forget debug log
53
+ debugLog('sourcemap', `Could not load source map for ${generatedFilePath}: ${error}`);
54
+ }
55
+ }
56
+ /**
57
+ * Find a matching source in a source map using proper path comparison
58
+ */
59
+ findMatchingSource(sources, originalSource) {
60
+ // Normalize the search path
61
+ const normalizedSearch = this.normalizePath(originalSource);
62
+ const searchBasename = path.basename(normalizedSearch);
63
+ // First, try exact match
64
+ for (const source of sources) {
65
+ const normalizedSource = this.normalizePath(source);
66
+ if (normalizedSource === normalizedSearch) {
67
+ return source;
68
+ }
69
+ }
70
+ // Second, try matching by filename + parent directory (more specific than just filename)
71
+ const searchParts = normalizedSearch.split('/');
72
+ if (searchParts.length >= 2) {
73
+ const searchSuffix = searchParts.slice(-2).join('/');
74
+ for (const source of sources) {
75
+ const normalizedSource = this.normalizePath(source);
76
+ if (normalizedSource.endsWith(searchSuffix)) {
77
+ return source;
78
+ }
79
+ }
80
+ }
81
+ // Third, try matching by exact filename only (least specific, but still requires exact filename match)
82
+ for (const source of sources) {
83
+ const sourceBasename = path.basename(this.normalizePath(source));
84
+ if (sourceBasename === searchBasename) {
85
+ return source;
86
+ }
87
+ }
88
+ return undefined;
89
+ }
90
+ /**
91
+ * Normalize a path for comparison
92
+ */
93
+ normalizePath(p) {
94
+ // Remove webpack:// or similar prefixes
95
+ let normalized = p.replace(/^webpack:\/\/[^/]*\//, '');
96
+ normalized = normalized.replace(/^file:\/\//, '');
97
+ normalized = normalized.replace(/^\.\//g, '');
98
+ // Normalize path separators
99
+ normalized = normalized.replace(/\\/g, '/');
100
+ // Remove leading ./
101
+ while (normalized.startsWith('./')) {
102
+ normalized = normalized.slice(2);
103
+ }
104
+ return normalized;
105
+ }
106
+ /**
107
+ * Map a TypeScript position to JavaScript position (for setting breakpoints)
108
+ */
109
+ async mapToGenerated(originalSource, originalLine, originalColumn = 0) {
110
+ if (this.clearing)
111
+ return null;
112
+ // First, check already-loaded source maps
113
+ for (const [generatedFile, consumer] of this.sourceMaps.entries()) {
114
+ if (this.clearing)
115
+ return null;
116
+ const sources = consumer.sources;
117
+ if (!sources)
118
+ continue;
119
+ const matchingSource = this.findMatchingSource(sources, originalSource);
120
+ if (matchingSource) {
121
+ const generated = consumer.generatedPositionFor({
122
+ source: matchingSource,
123
+ line: originalLine,
124
+ column: originalColumn,
125
+ });
126
+ if (generated.line !== null && generated.column !== null) {
127
+ return {
128
+ generatedFile,
129
+ line: generated.line,
130
+ column: generated.column,
131
+ };
132
+ }
133
+ }
134
+ }
135
+ // Lazy load: try pending source maps if not found in loaded ones
136
+ // Copy keys to avoid mutating map during iteration
137
+ const pendingKeys = Array.from(this.pendingSourceMaps.keys());
138
+ for (const scriptUrl of pendingKeys) {
139
+ if (this.clearing)
140
+ return null;
141
+ const sourceMapURL = this.pendingSourceMaps.get(scriptUrl);
142
+ if (!sourceMapURL)
143
+ continue; // already processed by another call
144
+ await this.loadSourceMapFromURL(scriptUrl, sourceMapURL);
145
+ this.pendingSourceMaps.delete(scriptUrl);
146
+ const consumer = this.sourceMaps.get(scriptUrl);
147
+ if (consumer) {
148
+ const sources = consumer.sources;
149
+ if (!sources)
150
+ continue;
151
+ const matchingSource = this.findMatchingSource(sources, originalSource);
152
+ if (matchingSource) {
153
+ const generated = consumer.generatedPositionFor({
154
+ source: matchingSource,
155
+ line: originalLine,
156
+ column: originalColumn,
157
+ });
158
+ if (generated.line !== null && generated.column !== null) {
159
+ return {
160
+ generatedFile: scriptUrl,
161
+ line: generated.line,
162
+ column: generated.column,
163
+ };
164
+ }
165
+ }
166
+ }
167
+ }
168
+ return null;
169
+ }
170
+ /**
171
+ * Map a JavaScript position to TypeScript position (for displaying location)
172
+ */
173
+ async mapToOriginal(generatedFile, generatedLine, generatedColumn = 0) {
174
+ if (this.clearing)
175
+ return null;
176
+ let consumer = this.sourceMaps.get(generatedFile);
177
+ // Lazy load: if not loaded but registered, load now
178
+ if (!consumer && this.pendingSourceMaps.has(generatedFile)) {
179
+ const sourceMapURL = this.pendingSourceMaps.get(generatedFile);
180
+ await this.loadSourceMapFromURL(generatedFile, sourceMapURL);
181
+ this.pendingSourceMaps.delete(generatedFile);
182
+ consumer = this.sourceMaps.get(generatedFile);
183
+ }
184
+ if (!consumer || this.clearing) {
185
+ return null;
186
+ }
187
+ const original = consumer.originalPositionFor({
188
+ line: generatedLine,
189
+ column: generatedColumn,
190
+ });
191
+ if (original.source && original.line !== null) {
192
+ return {
193
+ source: original.source,
194
+ line: original.line,
195
+ column: original.column || 0,
196
+ };
197
+ }
198
+ return null;
199
+ }
200
+ /**
201
+ * Load source map from URL or data URI (with proper concurrency handling)
202
+ */
203
+ async loadSourceMapFromURL(scriptUrl, sourceMapURL) {
204
+ if (this.clearing)
205
+ return;
206
+ // Already loaded
207
+ if (this.sourceMaps.has(scriptUrl)) {
208
+ return;
209
+ }
210
+ // Already loading - wait for existing load to complete
211
+ const existingPromise = this.loadingPromises.get(scriptUrl);
212
+ if (existingPromise) {
213
+ await existingPromise;
214
+ return;
215
+ }
216
+ // Create and store the loading promise
217
+ const loadPromise = this.doLoadSourceMap(scriptUrl, sourceMapURL);
218
+ this.loadingPromises.set(scriptUrl, loadPromise);
219
+ try {
220
+ await loadPromise;
221
+ }
222
+ finally {
223
+ this.loadingPromises.delete(scriptUrl);
224
+ }
225
+ }
226
+ /**
227
+ * Internal: Actually load the source map
228
+ */
229
+ async doLoadSourceMap(scriptUrl, sourceMapURL) {
230
+ try {
231
+ // Handle inline data URLs (data:application/json;base64,... or with charset)
232
+ if (sourceMapURL.startsWith('data:')) {
233
+ // More flexible regex: handles optional charset parameter
234
+ const match = sourceMapURL.match(/^data:application\/json(?:;charset=[^;]+)?;base64,(.+)$/);
235
+ if (match) {
236
+ const base64Data = match[1];
237
+ // Skip oversized inline source maps to prevent performance issues
238
+ if (base64Data.length > MAX_INLINE_SOURCEMAP_SIZE) {
239
+ this.recordError(scriptUrl, `Inline source map too large: ${base64Data.length} chars (max ${MAX_INLINE_SOURCEMAP_SIZE})`);
240
+ return;
241
+ }
242
+ const jsonData = Buffer.from(base64Data, 'base64').toString('utf-8');
243
+ const rawSourceMap = this.parseSourceMapJSON(jsonData, scriptUrl);
244
+ if (!rawSourceMap)
245
+ return;
246
+ const consumer = await new SourceMapConsumer(rawSourceMap);
247
+ if (!this.clearing) {
248
+ this.sourceMaps.set(scriptUrl, consumer);
249
+ debugLog('sourcemap', `Loaded inline source map for ${scriptUrl}`);
250
+ }
251
+ else {
252
+ consumer.destroy();
253
+ }
254
+ return;
255
+ }
256
+ // Handle non-base64 data URIs (URL-encoded)
257
+ const nonBase64Match = sourceMapURL.match(/^data:application\/json(?:;charset=[^;]+)?,(.+)$/);
258
+ if (nonBase64Match) {
259
+ try {
260
+ const jsonData = decodeURIComponent(nonBase64Match[1]);
261
+ if (jsonData.length > MAX_INLINE_SOURCEMAP_SIZE) {
262
+ this.recordError(scriptUrl, `Inline source map too large: ${jsonData.length} chars`);
263
+ return;
264
+ }
265
+ const rawSourceMap = this.parseSourceMapJSON(jsonData, scriptUrl);
266
+ if (!rawSourceMap)
267
+ return;
268
+ const consumer = await new SourceMapConsumer(rawSourceMap);
269
+ if (!this.clearing) {
270
+ this.sourceMaps.set(scriptUrl, consumer);
271
+ debugLog('sourcemap', `Loaded inline source map for ${scriptUrl}`);
272
+ }
273
+ else {
274
+ consumer.destroy();
275
+ }
276
+ return;
277
+ }
278
+ catch {
279
+ this.recordError(scriptUrl, 'Failed to decode non-base64 data URI');
280
+ return;
281
+ }
282
+ }
283
+ this.recordError(scriptUrl, 'Unrecognized data URI format');
284
+ return;
285
+ }
286
+ // Handle relative URLs - convert to absolute file path
287
+ let mapPath;
288
+ if (sourceMapURL.startsWith('http://') || sourceMapURL.startsWith('https://')) {
289
+ // For HTTP URLs, extract the path component and treat as local file
290
+ // Note: This is a best-effort heuristic for local development
291
+ const url = new URL(sourceMapURL);
292
+ mapPath = url.pathname;
293
+ if (mapPath.startsWith('/')) {
294
+ mapPath = path.join(process.cwd(), mapPath.slice(1));
295
+ }
296
+ }
297
+ else {
298
+ // Relative path - resolve relative to the script
299
+ const scriptPath = scriptUrl.replace(/^https?:\/\/[^/]+/, '');
300
+ const scriptDir = path.dirname(scriptPath);
301
+ mapPath = path.join(process.cwd(), scriptDir, sourceMapURL);
302
+ }
303
+ // Check file size before reading
304
+ let stats;
305
+ try {
306
+ stats = await fs.stat(mapPath);
307
+ }
308
+ catch {
309
+ // File doesn't exist - this is common and not an error worth reporting
310
+ return;
311
+ }
312
+ if (stats.size > MAX_FILE_SOURCEMAP_SIZE) {
313
+ this.recordError(scriptUrl, `Source map file too large: ${stats.size} bytes (max ${MAX_FILE_SOURCEMAP_SIZE})`);
314
+ return;
315
+ }
316
+ // Load the source map file
317
+ const mapContent = await fs.readFile(mapPath, 'utf-8');
318
+ const rawSourceMap = this.parseSourceMapJSON(mapContent, scriptUrl);
319
+ if (!rawSourceMap)
320
+ return;
321
+ const consumer = await new SourceMapConsumer(rawSourceMap);
322
+ if (!this.clearing) {
323
+ this.sourceMaps.set(scriptUrl, consumer);
324
+ debugLog('sourcemap', `Loaded source map for ${scriptUrl} from ${mapPath}`);
325
+ }
326
+ else {
327
+ consumer.destroy();
328
+ }
329
+ }
330
+ catch (error) {
331
+ this.recordError(scriptUrl, String(error));
332
+ debugLog('sourcemap', `Could not load source map for ${scriptUrl}: ${error}`);
333
+ }
334
+ }
335
+ /**
336
+ * Parse source map JSON with error tracking
337
+ */
338
+ parseSourceMapJSON(json, scriptUrl) {
339
+ try {
340
+ const parsed = JSON.parse(json);
341
+ // Basic validation
342
+ if (!parsed.mappings || typeof parsed.mappings !== 'string') {
343
+ this.recordError(scriptUrl, 'Invalid source map: missing or invalid mappings');
344
+ return null;
345
+ }
346
+ return parsed;
347
+ }
348
+ catch (error) {
349
+ this.recordError(scriptUrl, `Invalid JSON in source map: ${error}`);
350
+ return null;
351
+ }
352
+ }
353
+ /**
354
+ * Record an error for later inspection
355
+ */
356
+ recordError(scriptUrl, error) {
357
+ this.lastErrors.push({
358
+ scriptUrl,
359
+ error,
360
+ timestamp: Date.now(),
361
+ });
362
+ // Keep only last 20 errors
363
+ if (this.lastErrors.length > 20) {
364
+ this.lastErrors.shift();
365
+ }
366
+ }
367
+ /**
368
+ * Get recent source map loading errors (for debugging)
369
+ */
370
+ getRecentErrors() {
371
+ return [...this.lastErrors];
372
+ }
373
+ /**
374
+ * Clear error history
375
+ */
376
+ clearErrors() {
377
+ this.lastErrors = [];
378
+ }
379
+ /**
380
+ * Register source maps from a directory for lazy loading (does NOT eagerly load)
381
+ */
382
+ async registerSourceMapsFromDirectory(directory) {
383
+ if (this.clearing)
384
+ return 0;
385
+ let registered = 0;
386
+ try {
387
+ const entries = await fs.readdir(directory, { withFileTypes: true });
388
+ for (const entry of entries) {
389
+ const fullPath = path.join(directory, entry.name);
390
+ if (entry.isDirectory()) {
391
+ // Recurse into subdirectories
392
+ registered += await this.registerSourceMapsFromDirectory(fullPath);
393
+ }
394
+ else if (entry.name.endsWith('.js.map')) {
395
+ // Register the source map for the corresponding JS file
396
+ const jsPath = fullPath.slice(0, -4); // Remove .map
397
+ this.pendingSourceMaps.set(jsPath, fullPath);
398
+ registered++;
399
+ }
400
+ }
401
+ }
402
+ catch (error) {
403
+ debugLog('sourcemap', `Could not scan directory ${directory}: ${error}`);
404
+ }
405
+ return registered;
406
+ }
407
+ /**
408
+ * Force reload a source map (clear and re-register for lazy loading)
409
+ */
410
+ forceReload(scriptUrl, sourceMapURL) {
411
+ // Clear existing
412
+ const consumer = this.sourceMaps.get(scriptUrl);
413
+ if (consumer) {
414
+ consumer.destroy();
415
+ this.sourceMaps.delete(scriptUrl);
416
+ }
417
+ // Re-register for lazy loading if URL provided
418
+ if (sourceMapURL) {
419
+ this.pendingSourceMaps.set(scriptUrl, sourceMapURL);
420
+ }
421
+ }
422
+ /**
423
+ * Clear all loaded and pending source maps (safe for concurrent operations)
424
+ */
425
+ clear() {
426
+ this.clearing = true;
427
+ // Wait for any in-flight loads to notice the clearing flag
428
+ // They will destroy their consumers themselves
429
+ for (const consumer of this.sourceMaps.values()) {
430
+ consumer.destroy();
431
+ }
432
+ this.sourceMaps.clear();
433
+ this.pendingSourceMaps.clear();
434
+ this.loadingPromises.clear();
435
+ this.lastErrors = [];
436
+ this.clearing = false;
437
+ }
438
+ /**
439
+ * Clear a specific source map (loaded or pending)
440
+ */
441
+ clearSourceMap(scriptUrl) {
442
+ const consumer = this.sourceMaps.get(scriptUrl);
443
+ if (consumer) {
444
+ consumer.destroy();
445
+ this.sourceMaps.delete(scriptUrl);
446
+ return true;
447
+ }
448
+ if (this.pendingSourceMaps.has(scriptUrl)) {
449
+ this.pendingSourceMaps.delete(scriptUrl);
450
+ return true;
451
+ }
452
+ return false;
453
+ }
454
+ /**
455
+ * Get all loaded source map files
456
+ */
457
+ getLoadedSourceMaps() {
458
+ return Array.from(this.sourceMaps.keys());
459
+ }
460
+ /**
461
+ * Check if a source map is loaded or registered for a given file
462
+ */
463
+ hasSourceMap(file) {
464
+ return this.sourceMaps.has(file) || this.pendingSourceMaps.has(file);
465
+ }
466
+ /**
467
+ * Check if a source map is actually loaded (not just registered)
468
+ */
469
+ isSourceMapLoaded(file) {
470
+ return this.sourceMaps.has(file);
471
+ }
472
+ /**
473
+ * Get all registered (pending) source map URLs
474
+ */
475
+ getPendingSourceMaps() {
476
+ return Array.from(this.pendingSourceMaps.keys());
477
+ }
478
+ }
479
+ //# sourceMappingURL=sourcemap-handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sourcemap-handler.js","sourceRoot":"","sources":["../src/sourcemap-handler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAgB7C,gDAAgD;AAChD,MAAM,yBAAyB,GAAG,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,CAAC,iBAAiB,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;YAC1C,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YACzC,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;OAEG;IACH,mBAAmB;QACjB,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC;IAC5C,CAAC;IAED;;OAEG;IACH,YAAY,CAAC,IAAY;QACvB,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACvE,CAAC;IAED;;OAEG;IACH,iBAAiB,CAAC,IAAY;QAC5B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAED;;OAEG;IACH,oBAAoB;QAClB,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC,CAAC;IACnD,CAAC;CACF"}
@@ -0,0 +1,43 @@
1
+ export interface ChildManagerOptions {
2
+ execPath: string;
3
+ scriptPath: string;
4
+ extraArgs: string[];
5
+ cwd: string;
6
+ killGraceMs?: number;
7
+ /** How long a suspending child gets to release its resources (default: 15s). */
8
+ suspendGraceMs?: number;
9
+ }
10
+ export interface ChildExitInfo {
11
+ code: number | null;
12
+ signal: NodeJS.Signals | null;
13
+ }
14
+ export interface ChildStreams {
15
+ stdout: NodeJS.ReadableStream;
16
+ stdin: NodeJS.WritableStream;
17
+ }
18
+ export declare class ChildManager {
19
+ private readonly opts;
20
+ private child;
21
+ private onExitCallback;
22
+ private readonly killGraceMs;
23
+ private readonly suspendGraceMs;
24
+ constructor(opts: ChildManagerOptions);
25
+ /** Registered once; fires for every child this instance ever spawns. */
26
+ onExit(callback: (info: ChildExitInfo) => void): void;
27
+ spawn(): ChildStreams;
28
+ isRunning(): boolean;
29
+ /**
30
+ * Ask the child to release everything it holds - Chrome, managed dev
31
+ * servers, monitors - and exit, resolving once it has actually gone.
32
+ *
33
+ * SIGUSR2 rather than SIGUSR1 because Node reserves SIGUSR1 for starting its
34
+ * own inspector, and it is sent to the child alone rather than to its
35
+ * process group: the point is to give the child a chance to shut its own
36
+ * children down in order, not to kill them out from under it. If it doesn't
37
+ * finish in time, kill() escalates through the usual SIGTERM/SIGKILL path.
38
+ */
39
+ suspend(): Promise<void>;
40
+ /** Kill the current child (if any) and resolve once it has actually exited. */
41
+ kill(): Promise<void>;
42
+ }
43
+ //# sourceMappingURL=child-manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"child-manager.d.ts","sourceRoot":"","sources":["../../src/supervisor/child-manager.ts"],"names":[],"mappings":"AAiBA,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gFAAgF;IAChF,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;CAC/B;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC,cAAc,CAAC;IAC9B,KAAK,EAAE,MAAM,CAAC,cAAc,CAAC;CAC9B;AAED,qBAAa,YAAY;IAMX,OAAO,CAAC,QAAQ,CAAC,IAAI;IALjC,OAAO,CAAC,KAAK,CAA6B;IAC1C,OAAO,CAAC,cAAc,CAAgD;IACtE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAS;gBAEX,IAAI,EAAE,mBAAmB;IAKtD,wEAAwE;IACxE,MAAM,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,GAAG,IAAI;IAIrD,KAAK,IAAI,YAAY;IAqBrB,SAAS,IAAI,OAAO;IAIpB;;;;;;;;;OASG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAsC9B,+EAA+E;IACzE,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CA6C5B"}