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,34 @@
1
+ import { describe, it, expect, vi } from 'vitest';
2
+ import { requestSelfRestart } from './self-restart.js';
3
+ describe('requestSelfRestart', () => {
4
+ it('reports not-supervised when the pidfile is missing', async () => {
5
+ const readPidFile = vi.fn().mockRejectedValue(new Error('ENOENT'));
6
+ const sendSignal = vi.fn();
7
+ const result = await requestSelfRestart({ readPidFile, sendSignal });
8
+ expect(result).toEqual({ ok: false, reason: 'not-supervised' });
9
+ expect(sendSignal).not.toHaveBeenCalled();
10
+ });
11
+ it('reports not-supervised when the pidfile content is not a valid pid', async () => {
12
+ const readPidFile = vi.fn().mockResolvedValue('not-a-number');
13
+ const sendSignal = vi.fn();
14
+ const result = await requestSelfRestart({ readPidFile, sendSignal });
15
+ expect(result).toEqual({ ok: false, reason: 'not-supervised' });
16
+ expect(sendSignal).not.toHaveBeenCalled();
17
+ });
18
+ it('sends SIGUSR2 to the pid from the pidfile and reports success', async () => {
19
+ const readPidFile = vi.fn().mockResolvedValue('12345\n');
20
+ const sendSignal = vi.fn();
21
+ const result = await requestSelfRestart({ readPidFile, sendSignal });
22
+ expect(sendSignal).toHaveBeenCalledWith(12345, 'SIGUSR2');
23
+ expect(result).toEqual({ ok: true, pid: 12345 });
24
+ });
25
+ it('reports stale-pid when signaling the pid throws (process no longer exists)', async () => {
26
+ const readPidFile = vi.fn().mockResolvedValue('12345');
27
+ const sendSignal = vi.fn().mockImplementation(() => {
28
+ throw new Error('ESRCH');
29
+ });
30
+ const result = await requestSelfRestart({ readPidFile, sendSignal });
31
+ expect(result).toEqual({ ok: false, pid: 12345, reason: 'stale-pid', error: 'ESRCH' });
32
+ });
33
+ });
34
+ //# sourceMappingURL=self-restart.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"self-restart.test.js","sourceRoot":"","sources":["../src/self-restart.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,E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AE,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;QACzD,MAAM,UAAU,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;QAE3B,MAAM,MAAM,GAAG,MAAM,kBAAkB,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC,CAAC;QAErE,MAAM,CAAC,UAAU,CAAC,CAAC,oBAAoB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;QAC1D,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4EAA4E,EAAE,KAAK,IAAI,EAAE;QAC1F,MAAM,WAAW,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;QACvD,MAAM,UAAU,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,GAAG,EAAE;YACjD,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;QAEH,MAAM,MAAM,GAAG,MAAM,kBAAkB,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC,CAAC;QAErE,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;IACzF,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,161 @@
1
+ /**
2
+ * Ownership claims for managed dev servers.
3
+ *
4
+ * WHY THIS EXISTS
5
+ * `servers.json` records no owner, and every session in a directory reattaches
6
+ * to the same running servers, so no session could tell its own dev server
7
+ * from someone else's. That left two failures with one cause (issue #139):
8
+ * a window closed for good left its dev servers running until reboot, and an
9
+ * idle suspend could not release dev servers at all, because stopping one
10
+ * might pull it out from under another window still using it.
11
+ *
12
+ * WHAT A CLAIM IS
13
+ * One file per claim, named `<serverId>--<supervisorPid>.json`. A claim is
14
+ * valid exactly while its `supervisorPid` names a live process. The supervisor
15
+ * is the right anchor because it is the only process whose lifetime IS the
16
+ * session's: it survives the child dying on suspend and on every rebuild
17
+ * restart, and it dies when the client does (see supervisor/client-watcher.ts).
18
+ * A claim held by the MCP child instead would evaporate during a two-second
19
+ * rebuild, and another session suspending in that window would stop a server
20
+ * that is very much in use.
21
+ *
22
+ * WHY A DIRECTORY RATHER THAN ONE FILE
23
+ * Each file has exactly one writer, ever - the session named in its own
24
+ * filename. Creating is an atomic temp+rename, releasing is an unlink, and
25
+ * nothing anywhere does read-modify-write, so concurrent sessions cannot race.
26
+ * (`servers.json` itself is not safe this way: ServerManager's save mutex is
27
+ * per-process, so two sessions writing it can still lose an update. Putting
28
+ * owner fields in there would inherit that.)
29
+ *
30
+ * PRESENCE, NOT JUST CLAIMS
31
+ * A claim is taken when a session starts a server or reattaches to one at
32
+ * startup. That alone is not enough: a window already open when another window
33
+ * starts a dev server never gets to claim it, and would then have it stopped
34
+ * out from under it - the common ordering, not an edge case. So each session
35
+ * also records its presence in a project directory, and a server is protected
36
+ * while any other live session is working where it runs. That makes the rule
37
+ * independent of who started what, and of the order things happened in.
38
+ *
39
+ * THE RULE THIS SUPPORTS
40
+ * Stop a server only when no other LIVE session either claims it or is working
41
+ * in its directory. Anything unknown - unreadable directory, unparseable
42
+ * record, a liveness check that throws - counts as "someone might need it", so
43
+ * the server is left alone. The costs are asymmetric: under-stopping leaks a
44
+ * process until the next garbage collection, over-stopping destroys work that
45
+ * was running.
46
+ */
47
+ export interface ServerClaim {
48
+ serverId: string;
49
+ /** The claiming session's supervisor. Liveness of this pid IS the claim's validity. */
50
+ supervisorPid: number;
51
+ /** Start time of that supervisor, to survive pid reuse. Empty when unavailable. */
52
+ supervisorStartedAt: string;
53
+ /** Diagnostics only - which child process wrote the claim, and when. */
54
+ childPid: number;
55
+ cwd: string;
56
+ createdAt: string;
57
+ }
58
+ /**
59
+ * When a pid started, as the OS reports it.
60
+ *
61
+ * A pid alone cannot survive reuse: a recycled pid makes a dead session look
62
+ * alive, which pins its servers forever. Comparing start times distinguishes
63
+ * "still the same process" from "some new process wearing its number".
64
+ * Returns '' when it cannot be read, and callers treat that as "cannot
65
+ * disprove" rather than as a mismatch.
66
+ */
67
+ export declare function readProcessStartTime(pid: number): string;
68
+ export interface SessionPresence {
69
+ supervisorPid: number;
70
+ supervisorStartedAt: string;
71
+ childPid: number;
72
+ cwd: string;
73
+ startedAt: string;
74
+ }
75
+ export interface ClaimsStoreOptions {
76
+ /** Own supervisor pid; overridable for tests. */
77
+ supervisorPid?: number;
78
+ /** Reads a pid's start time; overridable for tests. */
79
+ startTimeReader?: (pid: number) => string;
80
+ /** Liveness check; overridable for tests. */
81
+ isAlive?: (pid: number) => boolean;
82
+ }
83
+ /**
84
+ * Reads and writes the claim files for one storage scope (local or global),
85
+ * mirroring where `servers.json` itself lives so a claim always sits beside
86
+ * the record it refers to.
87
+ */
88
+ export declare class ServerClaimsStore {
89
+ private readonly supervisorPid;
90
+ private readonly readStartTime;
91
+ private readonly isAlive;
92
+ private readonly ownStartTime;
93
+ constructor(options?: ClaimsStoreOptions);
94
+ getOwnSupervisorPid(): number;
95
+ private dir;
96
+ private claimPath;
97
+ /**
98
+ * Every claim on disk for a scope, dead ones included. Anything unreadable or
99
+ * unparseable is skipped rather than thrown: a corrupt claim must not be able
100
+ * to break a shutdown path.
101
+ */
102
+ readAll(global: boolean): Array<{
103
+ path: string;
104
+ claim: ServerClaim;
105
+ }>;
106
+ /**
107
+ * Whether a claim is still valid: its supervisor is alive, and (when both
108
+ * start times are readable) it is the same process that made the claim
109
+ * rather than a recycled pid.
110
+ */
111
+ isClaimLive(claim: ServerClaim): boolean;
112
+ /** Record this session as an owner of `serverId`. Idempotent. */
113
+ claim(serverId: string, cwd: string, global: boolean): Promise<void>;
114
+ /** Drop this session's claim on `serverId`, if it holds one. */
115
+ release(serverId: string, global: boolean): void;
116
+ /** Drop every claim this session holds, across both scopes. */
117
+ releaseAllOwn(): void;
118
+ /**
119
+ * Whether a live session OTHER than this one claims `serverId`.
120
+ */
121
+ hasForeignLiveClaim(serverId: string, global: boolean): boolean;
122
+ private sessionsDir;
123
+ private sessionPath;
124
+ /** Announce that this session is working in `cwd`. */
125
+ registerSession(cwd: string): Promise<void>;
126
+ /** Withdraw this session's presence record. */
127
+ unregisterSession(): void;
128
+ /** Every presence record on disk, dead ones included. */
129
+ readSessions(): Array<{
130
+ path: string;
131
+ presence: SessionPresence;
132
+ }>;
133
+ /**
134
+ * Whether another live session is working in `cwd`.
135
+ *
136
+ * This is what makes the rule independent of ordering: a window that was
137
+ * already open when someone else started a dev server never had a chance to
138
+ * claim it, but it is plainly still using the project.
139
+ */
140
+ hasOtherLiveSessionIn(cwd: string): boolean;
141
+ private isPresenceLive;
142
+ /** Delete presence records whose session is gone. */
143
+ collectDeadSessions(): number;
144
+ /**
145
+ * The whole decision, in one place: may this session stop `serverId`,
146
+ * running out of `serverCwd`?
147
+ */
148
+ mayStop(serverId: string, serverCwd: string, global: boolean): boolean;
149
+ /**
150
+ * Delete claims whose owning session is gone, and report which servers were
151
+ * left with no live claim at all - those are the ones nobody is coming back
152
+ * for.
153
+ */
154
+ collectDeadClaims(global: boolean): {
155
+ removed: number;
156
+ unclaimedServerIds: string[];
157
+ };
158
+ }
159
+ /** The store used by the running server. */
160
+ export declare const serverClaims: ServerClaimsStore;
161
+ //# sourceMappingURL=server-claims.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-claims.d.ts","sourceRoot":"","sources":["../src/server-claims.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAaH,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,uFAAuF;IACvF,aAAa,EAAE,MAAM,C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AAK,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAuB1E,gEAAgE;IAChE,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI;IAShD,+DAA+D;IAC/D,aAAa,IAAI,IAAI;IAarB;;OAEG;IACH,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO;IAW/D,OAAO,CAAC,WAAW;IAMnB,OAAO,CAAC,WAAW;IAInB,sDAAsD;IAChD,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAoBjD,+CAA+C;IAC/C,iBAAiB,IAAI,IAAI;IASzB,yDAAyD;IACzD,YAAY,IAAI,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,eAAe,CAAA;KAAE,CAAC;IA2BlE;;;;;;OAMG;IACH,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAU3C,OAAO,CAAC,cAAc;IAOtB,qDAAqD;IACrD,mBAAmB,IAAI,MAAM;IAc7B;;;OAGG;IACH,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO;IAMtE;;;;OAIG;IACH,iBAAiB,CAAC,MAAM,EAAE,OAAO,GAAG;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,kBAAkB,EAAE,MAAM,EAAE,CAAA;KAAE;CAwBtF;AAED,4CAA4C;AAC5C,eAAO,MAAM,YAAY,mBAA0B,CAAC"}
@@ -0,0 +1,382 @@
1
+ /**
2
+ * Ownership claims for managed dev servers.
3
+ *
4
+ * WHY THIS EXISTS
5
+ * `servers.json` records no owner, and every session in a directory reattaches
6
+ * to the same running servers, so no session could tell its own dev server
7
+ * from someone else's. That left two failures with one cause (issue #139):
8
+ * a window closed for good left its dev servers running until reboot, and an
9
+ * idle suspend could not release dev servers at all, because stopping one
10
+ * might pull it out from under another window still using it.
11
+ *
12
+ * WHAT A CLAIM IS
13
+ * One file per claim, named `<serverId>--<supervisorPid>.json`. A claim is
14
+ * valid exactly while its `supervisorPid` names a live process. The supervisor
15
+ * is the right anchor because it is the only process whose lifetime IS the
16
+ * session's: it survives the child dying on suspend and on every rebuild
17
+ * restart, and it dies when the client does (see supervisor/client-watcher.ts).
18
+ * A claim held by the MCP child instead would evaporate during a two-second
19
+ * rebuild, and another session suspending in that window would stop a server
20
+ * that is very much in use.
21
+ *
22
+ * WHY A DIRECTORY RATHER THAN ONE FILE
23
+ * Each file has exactly one writer, ever - the session named in its own
24
+ * filename. Creating is an atomic temp+rename, releasing is an unlink, and
25
+ * nothing anywhere does read-modify-write, so concurrent sessions cannot race.
26
+ * (`servers.json` itself is not safe this way: ServerManager's save mutex is
27
+ * per-process, so two sessions writing it can still lose an update. Putting
28
+ * owner fields in there would inherit that.)
29
+ *
30
+ * PRESENCE, NOT JUST CLAIMS
31
+ * A claim is taken when a session starts a server or reattaches to one at
32
+ * startup. That alone is not enough: a window already open when another window
33
+ * starts a dev server never gets to claim it, and would then have it stopped
34
+ * out from under it - the common ordering, not an edge case. So each session
35
+ * also records its presence in a project directory, and a server is protected
36
+ * while any other live session is working where it runs. That makes the rule
37
+ * independent of who started what, and of the order things happened in.
38
+ *
39
+ * THE RULE THIS SUPPORTS
40
+ * Stop a server only when no other LIVE session either claims it or is working
41
+ * in its directory. Anything unknown - unreadable directory, unparseable
42
+ * record, a liveness check that throws - counts as "someone might need it", so
43
+ * the server is left alone. The costs are asymmetric: under-stopping leaks a
44
+ * process until the next garbage collection, over-stopping destroys work that
45
+ * was running.
46
+ */
47
+ import { existsSync, mkdirSync, readdirSync, readFileSync, realpathSync, unlinkSync } from 'fs';
48
+ import { join } from 'path';
49
+ import { execFileSync } from 'child_process';
50
+ import { atomicWriteFile } from './atomic-write.js';
51
+ import { getOutputPath } from './helpers/paths.js';
52
+ import { isProcessAlive } from './helpers/process-liveness.js';
53
+ import { debugLog } from './debug-logger.js';
54
+ const CLAIMS_DIR = 'server-claims';
55
+ const SESSIONS_DIR = 'sessions';
56
+ /**
57
+ * The supervisor that owns this session.
58
+ *
59
+ * The child is spawned directly by the supervisor (see supervisor/child-manager.ts),
60
+ * so its parent is the right pid, captured once at startup: `process.ppid`
61
+ * changes to 1 if the parent dies, which would silently reassign ownership.
62
+ */
63
+ const OWN_SUPERVISOR_PID = process.ppid;
64
+ /**
65
+ * When a pid started, as the OS reports it.
66
+ *
67
+ * A pid alone cannot survive reuse: a recycled pid makes a dead session look
68
+ * alive, which pins its servers forever. Comparing start times distinguishes
69
+ * "still the same process" from "some new process wearing its number".
70
+ * Returns '' when it cannot be read, and callers treat that as "cannot
71
+ * disprove" rather than as a mismatch.
72
+ */
73
+ export function readProcessStartTime(pid) {
74
+ if (process.platform === 'win32')
75
+ return '';
76
+ try {
77
+ return execFileSync('ps', ['-o', 'lstart=', '-p', String(pid)], {
78
+ encoding: 'utf-8',
79
+ timeout: 2000,
80
+ }).trim();
81
+ }
82
+ catch {
83
+ return '';
84
+ }
85
+ }
86
+ /**
87
+ * A directory path in the one form everything compares against.
88
+ *
89
+ * On macOS the same directory is reachable as both `/tmp/x` and `/private/tmp/x`,
90
+ * and a server's recorded cwd and a session's `process.cwd()` routinely
91
+ * disagree about which - so a plain string comparison silently decides two
92
+ * windows in the same project are in different ones, and stops a server that
93
+ * is in use.
94
+ */
95
+ function canonicalPath(dir) {
96
+ try {
97
+ return realpathSync(dir);
98
+ }
99
+ catch {
100
+ return dir;
101
+ }
102
+ }
103
+ /**
104
+ * Reads and writes the claim files for one storage scope (local or global),
105
+ * mirroring where `servers.json` itself lives so a claim always sits beside
106
+ * the record it refers to.
107
+ */
108
+ export class ServerClaimsStore {
109
+ supervisorPid;
110
+ readStartTime;
111
+ isAlive;
112
+ ownStartTime;
113
+ constructor(options = {}) {
114
+ this.supervisorPid = options.supervisorPid ?? OWN_SUPERVISOR_PID;
115
+ this.readStartTime = options.startTimeReader ?? readProcessStartTime;
116
+ this.isAlive = options.isAlive ?? isProcessAlive;
117
+ this.ownStartTime = this.readStartTime(this.supervisorPid);
118
+ }
119
+ getOwnSupervisorPid() {
120
+ return this.supervisorPid;
121
+ }
122
+ dir(global) {
123
+ return getOutputPath(CLAIMS_DIR, { global });
124
+ }
125
+ claimPath(serverId, global) {
126
+ return join(this.dir(global), `${encodeURIComponent(serverId)}--${this.supervisorPid}.json`);
127
+ }
128
+ /**
129
+ * Every claim on disk for a scope, dead ones included. Anything unreadable or
130
+ * unparseable is skipped rather than thrown: a corrupt claim must not be able
131
+ * to break a shutdown path.
132
+ */
133
+ readAll(global) {
134
+ const dir = this.dir(global);
135
+ if (!existsSync(dir))
136
+ return [];
137
+ const claims = [];
138
+ let entries;
139
+ try {
140
+ entries = readdirSync(dir);
141
+ }
142
+ catch {
143
+ return [];
144
+ }
145
+ for (const entry of entries) {
146
+ if (!entry.endsWith('.json'))
147
+ continue;
148
+ const path = join(dir, entry);
149
+ try {
150
+ const claim = JSON.parse(readFileSync(path, 'utf-8'));
151
+ if (typeof claim?.serverId === 'string' && Number.isInteger(claim?.supervisorPid)) {
152
+ claims.push({ path, claim });
153
+ }
154
+ }
155
+ catch {
156
+ // Unreadable or corrupt - ignore it. It will be collected as dead only
157
+ // if its filename says so; otherwise it is simply not counted.
158
+ }
159
+ }
160
+ return claims;
161
+ }
162
+ /**
163
+ * Whether a claim is still valid: its supervisor is alive, and (when both
164
+ * start times are readable) it is the same process that made the claim
165
+ * rather than a recycled pid.
166
+ */
167
+ isClaimLive(claim) {
168
+ if (!this.isAlive(claim.supervisorPid))
169
+ return false;
170
+ const currentStart = this.readStartTime(claim.supervisorPid);
171
+ // Either side unreadable means we cannot disprove it - and an unprovable
172
+ // claim must count as live, since the cost of being wrong the other way is
173
+ // stopping a running server.
174
+ if (!currentStart || !claim.supervisorStartedAt)
175
+ return true;
176
+ return currentStart === claim.supervisorStartedAt;
177
+ }
178
+ /** Record this session as an owner of `serverId`. Idempotent. */
179
+ async claim(serverId, cwd, global) {
180
+ const dir = this.dir(global);
181
+ try {
182
+ if (!existsSync(dir))
183
+ mkdirSync(dir, { recursive: true });
184
+ const claim = {
185
+ serverId,
186
+ supervisorPid: this.supervisorPid,
187
+ supervisorStartedAt: this.ownStartTime,
188
+ childPid: process.pid,
189
+ cwd,
190
+ createdAt: new Date().toISOString(),
191
+ };
192
+ await atomicWriteFile(this.claimPath(serverId, global), JSON.stringify(claim, null, 2));
193
+ }
194
+ catch (error) {
195
+ // A server with no claim is unprotected against another session's
196
+ // garbage collection, so this is worth being loud about even though it
197
+ // must not fail the start itself.
198
+ console.error(`[cdp-tools] Could not claim server "${serverId}": ${error}`);
199
+ await debugLog('ServerClaims', `Failed to claim ${serverId}: ${error}`);
200
+ }
201
+ }
202
+ /** Drop this session's claim on `serverId`, if it holds one. */
203
+ release(serverId, global) {
204
+ try {
205
+ const path = this.claimPath(serverId, global);
206
+ if (existsSync(path))
207
+ unlinkSync(path);
208
+ }
209
+ catch (error) {
210
+ void debugLog('ServerClaims', `Failed to release claim on ${serverId}: ${error}`);
211
+ }
212
+ }
213
+ /** Drop every claim this session holds, across both scopes. */
214
+ releaseAllOwn() {
215
+ for (const global of [false, true]) {
216
+ for (const { path, claim } of this.readAll(global)) {
217
+ if (claim.supervisorPid !== this.supervisorPid)
218
+ continue;
219
+ try {
220
+ unlinkSync(path);
221
+ }
222
+ catch {
223
+ // Already gone, or not ours to remove.
224
+ }
225
+ }
226
+ }
227
+ }
228
+ /**
229
+ * Whether a live session OTHER than this one claims `serverId`.
230
+ */
231
+ hasForeignLiveClaim(serverId, global) {
232
+ return this.readAll(global).some(({ claim }) => claim.serverId === serverId &&
233
+ claim.supervisorPid !== this.supervisorPid &&
234
+ this.isClaimLive(claim));
235
+ }
236
+ // ---------------------------------------------------------------- presence
237
+ sessionsDir() {
238
+ // Always global: a session's presence is a fact about the machine, and the
239
+ // sessions that need to see it may not share this one's project storage.
240
+ return getOutputPath(SESSIONS_DIR, { global: true });
241
+ }
242
+ sessionPath(supervisorPid) {
243
+ return join(this.sessionsDir(), `${supervisorPid}.json`);
244
+ }
245
+ /** Announce that this session is working in `cwd`. */
246
+ async registerSession(cwd) {
247
+ try {
248
+ const dir = this.sessionsDir();
249
+ if (!existsSync(dir))
250
+ mkdirSync(dir, { recursive: true });
251
+ const presence = {
252
+ supervisorPid: this.supervisorPid,
253
+ supervisorStartedAt: this.ownStartTime,
254
+ childPid: process.pid,
255
+ cwd: canonicalPath(cwd),
256
+ startedAt: new Date().toISOString(),
257
+ };
258
+ await atomicWriteFile(this.sessionPath(this.supervisorPid), JSON.stringify(presence, null, 2));
259
+ }
260
+ catch (error) {
261
+ // Losing our own presence record only risks another session collecting a
262
+ // server we are using, so it is worth saying out loud.
263
+ console.error(`[cdp-tools] Could not record session presence: ${error}`);
264
+ }
265
+ }
266
+ /** Withdraw this session's presence record. */
267
+ unregisterSession() {
268
+ try {
269
+ const path = this.sessionPath(this.supervisorPid);
270
+ if (existsSync(path))
271
+ unlinkSync(path);
272
+ }
273
+ catch {
274
+ // Already gone.
275
+ }
276
+ }
277
+ /** Every presence record on disk, dead ones included. */
278
+ readSessions() {
279
+ const dir = this.sessionsDir();
280
+ if (!existsSync(dir))
281
+ return [];
282
+ const sessions = [];
283
+ let entries;
284
+ try {
285
+ entries = readdirSync(dir);
286
+ }
287
+ catch {
288
+ return [];
289
+ }
290
+ for (const entry of entries) {
291
+ if (!entry.endsWith('.json'))
292
+ continue;
293
+ const path = join(dir, entry);
294
+ try {
295
+ const presence = JSON.parse(readFileSync(path, 'utf-8'));
296
+ if (Number.isInteger(presence?.supervisorPid) && typeof presence?.cwd === 'string') {
297
+ sessions.push({ path, presence });
298
+ }
299
+ }
300
+ catch {
301
+ // Corrupt record - ignore.
302
+ }
303
+ }
304
+ return sessions;
305
+ }
306
+ /**
307
+ * Whether another live session is working in `cwd`.
308
+ *
309
+ * This is what makes the rule independent of ordering: a window that was
310
+ * already open when someone else started a dev server never had a chance to
311
+ * claim it, but it is plainly still using the project.
312
+ */
313
+ hasOtherLiveSessionIn(cwd) {
314
+ const target = canonicalPath(cwd);
315
+ return this.readSessions().some(({ presence }) => presence.supervisorPid !== this.supervisorPid &&
316
+ canonicalPath(presence.cwd) === target &&
317
+ this.isPresenceLive(presence));
318
+ }
319
+ isPresenceLive(presence) {
320
+ if (!this.isAlive(presence.supervisorPid))
321
+ return false;
322
+ const currentStart = this.readStartTime(presence.supervisorPid);
323
+ if (!currentStart || !presence.supervisorStartedAt)
324
+ return true;
325
+ return currentStart === presence.supervisorStartedAt;
326
+ }
327
+ /** Delete presence records whose session is gone. */
328
+ collectDeadSessions() {
329
+ let removed = 0;
330
+ for (const { path, presence } of this.readSessions()) {
331
+ if (this.isPresenceLive(presence))
332
+ continue;
333
+ try {
334
+ unlinkSync(path);
335
+ removed++;
336
+ }
337
+ catch {
338
+ // Someone else got there first.
339
+ }
340
+ }
341
+ return removed;
342
+ }
343
+ /**
344
+ * The whole decision, in one place: may this session stop `serverId`,
345
+ * running out of `serverCwd`?
346
+ */
347
+ mayStop(serverId, serverCwd, global) {
348
+ if (this.hasForeignLiveClaim(serverId, global))
349
+ return false;
350
+ if (this.hasOtherLiveSessionIn(serverCwd))
351
+ return false;
352
+ return true;
353
+ }
354
+ /**
355
+ * Delete claims whose owning session is gone, and report which servers were
356
+ * left with no live claim at all - those are the ones nobody is coming back
357
+ * for.
358
+ */
359
+ collectDeadClaims(global) {
360
+ const all = this.readAll(global);
361
+ let removed = 0;
362
+ const liveByServer = new Map();
363
+ for (const { path, claim } of all) {
364
+ if (this.isClaimLive(claim)) {
365
+ liveByServer.set(claim.serverId, (liveByServer.get(claim.serverId) ?? 0) + 1);
366
+ continue;
367
+ }
368
+ try {
369
+ unlinkSync(path);
370
+ removed++;
371
+ }
372
+ catch {
373
+ // Someone else collected it first; fine either way.
374
+ }
375
+ }
376
+ const unclaimedServerIds = [...new Set(all.map(({ claim }) => claim.serverId))].filter((serverId) => !liveByServer.has(serverId));
377
+ return { removed, unclaimedServerIds };
378
+ }
379
+ }
380
+ /** The store used by the running server. */
381
+ export const serverClaims = new ServerClaimsStore();
382
+ //# sourceMappingURL=server-claims.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-claims.js","sourceRoot":"","sources":["../src/server-claims.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChG,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,MAAM,UAAU,GAAG,eAAe,CAAC;AACnC,MAAM,YAAY,GAAG,UAAU,CAAC;AAchC;;;;;;GAMG;AACH,MAAM,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;AAExC;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB,CAAC,GAAW;IAC9C,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO;QAAE,OAAO,EAAE,CAAC;IAC5C,IAAI,CAAC;QACH,OAAO,YAAY,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE;YAC9D,QAAQ,EAAE,OAAO;YACjB,OAAO,EAAE,IAAI;SACd,CAAC,CAAC,IAA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BAC9E,SAAS;YACX,CAAC;YACD,IAAI,CAAC;gBACH,UAAU,CAAC,IAAI,CAAC,CAAC;gBACjB,OAAO,EAAE,CAAC;YACZ,CAAC;YAAC,MAAM,CAAC;gBACP,oDAAoD;YACtD,CAAC;QACH,CAAC;QAED,MAAM,kBAAkB,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CACpF,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,CAC1C,CAAC;QAEF,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,CAAC;IACzC,CAAC;CACF;AAED,4CAA4C;AAC5C,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,iBAAiB,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=server-claims.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-claims.test.d.ts","sourceRoot":"","sources":["../src/server-claims.test.ts"],"names":[],"mappings":""}