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,105 @@
1
+ /**
2
+ * Recursive file-change watcher for cdp-tools-managed dev servers.
3
+ *
4
+ * Manual recursive fs.watch (one watcher per directory) rather than the
5
+ * `recursive: true` option, which isn't reliably cross-platform - and
6
+ * rather than a dependency like chokidar, to keep this dependency-free like
7
+ * the rest of this codebase's process-management code. Debounced so a burst
8
+ * of writes (e.g. a save-all, or a build tool writing many files) collapses
9
+ * to one change notification.
10
+ *
11
+ * Known v1 limitation: this opens one file descriptor per watched
12
+ * directory, which doesn't scale to huge trees. Not solved here (no cap,
13
+ * no .gitignore-awareness) - acceptable for typical project sizes, and
14
+ * consistent with the "no new dependency" constraint.
15
+ */
16
+ import * as fs from 'fs';
17
+ import * as path from 'path';
18
+ const DEFAULT_EXCLUDE_DIR_NAMES = [
19
+ 'node_modules', '.git', 'dist', 'build', '.cdp-tools',
20
+ '.next', 'coverage', 'out', '.turbo', 'tmp',
21
+ ];
22
+ export class ServerFileWatcher {
23
+ options;
24
+ watchers = new Map();
25
+ debounceTimer = null;
26
+ excludeDirNames;
27
+ debounceMs;
28
+ onChange;
29
+ stopped = false;
30
+ constructor(options) {
31
+ this.options = options;
32
+ this.excludeDirNames = new Set(options.excludeDirNames ?? DEFAULT_EXCLUDE_DIR_NAMES);
33
+ this.debounceMs = options.debounceMs ?? 400;
34
+ this.onChange = options.onChange;
35
+ }
36
+ start() {
37
+ for (const root of this.options.paths) {
38
+ this.watchDir(root);
39
+ }
40
+ }
41
+ watchDir(dir) {
42
+ if (this.stopped || this.watchers.has(dir)) {
43
+ return;
44
+ }
45
+ let watcher;
46
+ try {
47
+ watcher = fs.watch(dir, (_eventType, filename) => this.handleEvent(dir, filename));
48
+ }
49
+ catch {
50
+ return; // Directory may not exist or isn't readable - skip silently.
51
+ }
52
+ this.watchers.set(dir, watcher);
53
+ let entries;
54
+ try {
55
+ entries = fs.readdirSync(dir, { withFileTypes: true });
56
+ }
57
+ catch {
58
+ return;
59
+ }
60
+ for (const entry of entries) {
61
+ if (entry.isDirectory() && !this.excludeDirNames.has(entry.name)) {
62
+ this.watchDir(path.join(dir, entry.name));
63
+ }
64
+ }
65
+ }
66
+ handleEvent(dir, filename) {
67
+ if (this.stopped) {
68
+ return;
69
+ }
70
+ // A new subdirectory may have just appeared - start watching it too, so
71
+ // future changes inside it aren't missed.
72
+ if (filename) {
73
+ const fullPath = path.join(dir, filename);
74
+ if (!this.watchers.has(fullPath) && !this.excludeDirNames.has(filename)) {
75
+ try {
76
+ if (fs.statSync(fullPath).isDirectory()) {
77
+ this.watchDir(fullPath);
78
+ }
79
+ }
80
+ catch {
81
+ // Deleted, a file, or a benign race - nothing to do either way.
82
+ }
83
+ }
84
+ }
85
+ if (this.debounceTimer) {
86
+ clearTimeout(this.debounceTimer);
87
+ }
88
+ this.debounceTimer = setTimeout(() => {
89
+ this.debounceTimer = null;
90
+ this.onChange();
91
+ }, this.debounceMs);
92
+ }
93
+ stop() {
94
+ this.stopped = true;
95
+ if (this.debounceTimer) {
96
+ clearTimeout(this.debounceTimer);
97
+ this.debounceTimer = null;
98
+ }
99
+ for (const watcher of this.watchers.values()) {
100
+ watcher.close();
101
+ }
102
+ this.watchers.clear();
103
+ }
104
+ }
105
+ //# sourceMappingURL=server-watcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-watcher.js","sourceRoot":"","sources":["../src/server-watcher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,MAAM,yBAAyB,GAAG;IAChC,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY;IACrD,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK;CAC5C,CAAC;AASF,MAAM,OAAO,iBAAiB;IAQC;IAPrB,QAAQ,GAAG,IAAI,GAAG,EAAwB,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;IACtB,CAAC;IAED,IAAI;QACF,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YACvB,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YACjC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAC5B,CAAC;QACD,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC;YAC7C,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,CAAC;QACD,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;CACF"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Session Detector
3
+ *
4
+ * Tracks Claude Code sessions and agents by watching .jsonl files.
5
+ *
6
+ * HOW IT WORKS:
7
+ * 1. Starts monitoring ALL .jsonl files immediately when created
8
+ * 2. Every tool response includes "pid:XXXXX" (added in index.ts)
9
+ * 3. After first tool, verify(pid) sets the PID to filter for
10
+ * 4. Detects session changes, agent activity, and tracks entry counts
11
+ *
12
+ * STREAMS:
13
+ * - session$: Emits when main session changes (PID in different {uuid}.jsonl)
14
+ * - agents$: Emits when agent list changes (PID in agent-{uuid}.jsonl files)
15
+ * - entryCount$: Emits running count of entries in current session file
16
+ */
17
+ import { Observable } from 'rxjs';
18
+ export interface SessionInfo {
19
+ sessionId: string;
20
+ shortId: string;
21
+ sessionFile: string;
22
+ detectedAt: number;
23
+ }
24
+ export interface AgentInfo {
25
+ agentId: string;
26
+ shortId: string;
27
+ agentFile: string;
28
+ startedAt: number;
29
+ }
30
+ export interface SessionState {
31
+ mainSession: SessionInfo | null;
32
+ activeAgents: AgentInfo[];
33
+ entryCount: number;
34
+ }
35
+ export interface SessionDetector {
36
+ session$: Observable<SessionInfo>;
37
+ agents$: Observable<AgentInfo[]>;
38
+ entryCount$: Observable<number>;
39
+ getState(): SessionState;
40
+ verify(pid: number): void;
41
+ stop(): void;
42
+ }
43
+ /**
44
+ * Create a session detector that tracks sessions and agents
45
+ */
46
+ export declare function createSessionDetector(cwd: string): SessionDetector;
47
+ //# sourceMappingURL=session-detector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-detector.d.ts","sourceRoot":"","sources":["../src/session-detector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,UAAU,EAA4B,MAAM,MAAM,CAAC;AAO5D,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;IAChC,YAAY,EAAE,SAAS,EAAE,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;CACpB;AAWD,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;IAClC,OAAO,EAAE,UAAU,CAAC,SAAS,EAAE,CAAC,CAAC;IACjC,WAAW,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;IAChC,QAAQ,IAAI,YAAY,CAAC;IACzB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,IAAI,IAAI,IAAI,CAAC;CACd;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,CAoPlE"}
@@ -0,0 +1,229 @@
1
+ /**
2
+ * Session Detector
3
+ *
4
+ * Tracks Claude Code sessions and agents by watching .jsonl files.
5
+ *
6
+ * HOW IT WORKS:
7
+ * 1. Starts monitoring ALL .jsonl files immediately when created
8
+ * 2. Every tool response includes "pid:XXXXX" (added in index.ts)
9
+ * 3. After first tool, verify(pid) sets the PID to filter for
10
+ * 4. Detects session changes, agent activity, and tracks entry counts
11
+ *
12
+ * STREAMS:
13
+ * - session$: Emits when main session changes (PID in different {uuid}.jsonl)
14
+ * - agents$: Emits when agent list changes (PID in agent-{uuid}.jsonl files)
15
+ * - entryCount$: Emits running count of entries in current session file
16
+ */
17
+ import { Subject, BehaviorSubject } from 'rxjs';
18
+ import { filter, takeUntil } from 'rxjs/operators';
19
+ import { watch, readdirSync, statSync, openSync, readSync, closeSync } from 'fs';
20
+ import { join } from 'path';
21
+ import { homedir } from 'os';
22
+ import { debugLog } from './debug-logger.js';
23
+ /**
24
+ * Create a session detector that tracks sessions and agents
25
+ */
26
+ export function createSessionDetector(cwd) {
27
+ const projectPath = cwd.replace(/\//g, '-');
28
+ const claudeProjectDir = join(homedir(), '.claude', 'projects', projectPath);
29
+ const stop$ = new Subject();
30
+ const changes$ = new Subject();
31
+ // State
32
+ let pidPattern = null;
33
+ let currentSessionFile = null;
34
+ const activeAgents = new Map();
35
+ // Output subjects
36
+ const session$ = new Subject();
37
+ const agents$ = new BehaviorSubject([]);
38
+ const entryCount$ = new BehaviorSubject(0);
39
+ // File watching state
40
+ const filePositions = new Map();
41
+ const watchers = new Map();
42
+ // ============ File Watching ============
43
+ const readNewContent = (filePath) => {
44
+ try {
45
+ const stats = statSync(filePath);
46
+ const lastPos = filePositions.get(filePath) ?? stats.size;
47
+ if (stats.size <= lastPos) {
48
+ filePositions.set(filePath, stats.size);
49
+ return null;
50
+ }
51
+ const readSize = stats.size - lastPos;
52
+ const fd = openSync(filePath, 'r');
53
+ const buffer = Buffer.alloc(readSize);
54
+ try {
55
+ readSync(fd, buffer, 0, readSize, lastPos);
56
+ }
57
+ finally {
58
+ closeSync(fd);
59
+ }
60
+ filePositions.set(filePath, stats.size);
61
+ const content = buffer.toString('utf-8');
62
+ const lineCount = (content.match(/\n/g) || []).length;
63
+ return { content, lineCount };
64
+ }
65
+ catch {
66
+ return null;
67
+ }
68
+ };
69
+ const extractId = (fileName) => {
70
+ return fileName.replace('.jsonl', '').replace(/^agent-/, '');
71
+ };
72
+ const watchFile = (filePath) => {
73
+ if (watchers.has(filePath))
74
+ return;
75
+ const fileName = filePath.split('/').pop() || '';
76
+ try {
77
+ const stats = statSync(filePath);
78
+ filePositions.set(filePath, stats.size);
79
+ }
80
+ catch {
81
+ return;
82
+ }
83
+ const watcher = watch(filePath, { persistent: false }, (eventType) => {
84
+ if (eventType !== 'change')
85
+ return;
86
+ const result = readNewContent(filePath);
87
+ if (!result || result.content.length === 0)
88
+ return;
89
+ const isAgent = fileName.startsWith('agent-');
90
+ const sessionId = extractId(fileName);
91
+ changes$.next({
92
+ filePath,
93
+ fileName,
94
+ content: result.content,
95
+ lineCount: result.lineCount,
96
+ isAgent,
97
+ sessionId,
98
+ });
99
+ });
100
+ watchers.set(filePath, watcher);
101
+ };
102
+ const watchDirectory = () => {
103
+ try {
104
+ const files = readdirSync(claudeProjectDir).filter(f => f.endsWith('.jsonl') &&
105
+ f !== '00000000-0000-0000-0000-000000000000.jsonl');
106
+ debugLog('session-detector', `[monitor] Watching ${files.length} files in ${claudeProjectDir}`);
107
+ for (const file of files) {
108
+ watchFile(join(claudeProjectDir, file));
109
+ }
110
+ const dirWatcher = watch(claudeProjectDir, { persistent: false }, (eventType, filename) => {
111
+ if (eventType === 'rename' && filename?.endsWith('.jsonl')) {
112
+ const filePath = join(claudeProjectDir, filename);
113
+ if (!watchers.has(filePath)) {
114
+ debugLog('session-detector', `[monitor] New file: ${filename}`);
115
+ setTimeout(() => watchFile(filePath), 50);
116
+ }
117
+ }
118
+ });
119
+ watchers.set(claudeProjectDir, dirWatcher);
120
+ }
121
+ catch {
122
+ setTimeout(watchDirectory, 1000);
123
+ }
124
+ };
125
+ // ============ Stream Processing ============
126
+ const processMonitor = (change) => {
127
+ if (!pidPattern) {
128
+ debugLog('session-detector', `[monitor] Activity (awaiting PID): ${change.fileName}`);
129
+ return;
130
+ }
131
+ if (!change.content.includes(pidPattern))
132
+ return;
133
+ if (change.isAgent) {
134
+ if (!activeAgents.has(change.sessionId)) {
135
+ debugLog('session-detector', `[monitor] New agent: ${change.sessionId.substring(0, 8)}`);
136
+ const agent = {
137
+ agentId: change.sessionId,
138
+ shortId: change.sessionId.substring(0, 8),
139
+ agentFile: change.filePath,
140
+ startedAt: Date.now(),
141
+ };
142
+ activeAgents.set(change.sessionId, agent);
143
+ agents$.next(Array.from(activeAgents.values()));
144
+ }
145
+ }
146
+ else {
147
+ if (change.filePath !== currentSessionFile) {
148
+ const isInitialDetection = currentSessionFile === null;
149
+ const hadAgents = activeAgents.size > 0;
150
+ activeAgents.clear();
151
+ agents$.next([]);
152
+ entryCount$.next(0);
153
+ currentSessionFile = change.filePath;
154
+ if (isInitialDetection) {
155
+ debugLog('session-detector', `[monitor] Session verified: ${change.sessionId.substring(0, 8)}`);
156
+ }
157
+ else {
158
+ debugLog('session-detector', `[monitor] Session changed: ${change.sessionId.substring(0, 8)}${hadAgents ? ' (agents cleared)' : ''}`);
159
+ }
160
+ session$.next({
161
+ sessionId: change.sessionId,
162
+ shortId: change.sessionId.substring(0, 8),
163
+ sessionFile: change.filePath,
164
+ detectedAt: Date.now(),
165
+ });
166
+ }
167
+ }
168
+ };
169
+ const processSession = (change) => {
170
+ if (change.filePath !== currentSessionFile)
171
+ return;
172
+ entryCount$.next(entryCount$.value + change.lineCount);
173
+ };
174
+ // ============ Start Monitoring ============
175
+ debugLog('session-detector', `[monitor] Starting`);
176
+ watchDirectory();
177
+ // Monitor stream - all file changes
178
+ changes$.pipe(takeUntil(stop$)).subscribe(processMonitor);
179
+ // Session stream - only our verified session
180
+ changes$.pipe(takeUntil(stop$), filter(c => !c.isAgent && currentSessionFile !== null && c.filePath === currentSessionFile)).subscribe(processSession);
181
+ // ============ Public API ============
182
+ const verify = (pid) => {
183
+ if (pidPattern)
184
+ return;
185
+ pidPattern = `pid:${pid}`;
186
+ debugLog('session-detector', `[monitor] Now filtering for PID ${pid}`);
187
+ };
188
+ const stop = () => {
189
+ debugLog('session-detector', `[monitor] Stopping`);
190
+ stop$.next();
191
+ stop$.complete();
192
+ for (const watcher of watchers.values()) {
193
+ watcher.close();
194
+ }
195
+ watchers.clear();
196
+ filePositions.clear();
197
+ changes$.complete();
198
+ session$.complete();
199
+ agents$.complete();
200
+ entryCount$.complete();
201
+ };
202
+ const getState = () => {
203
+ let mainSession = null;
204
+ if (currentSessionFile) {
205
+ const fileName = currentSessionFile.split('/').pop() || '';
206
+ const sessionId = fileName.replace('.jsonl', '');
207
+ mainSession = {
208
+ sessionId,
209
+ shortId: sessionId.substring(0, 8),
210
+ sessionFile: currentSessionFile,
211
+ detectedAt: Date.now(),
212
+ };
213
+ }
214
+ return {
215
+ mainSession,
216
+ activeAgents: Array.from(activeAgents.values()),
217
+ entryCount: entryCount$.value,
218
+ };
219
+ };
220
+ return {
221
+ session$: session$.asObservable(),
222
+ agents$: agents$.asObservable(),
223
+ entryCount$: entryCount$.asObservable(),
224
+ getState,
225
+ verify,
226
+ stop,
227
+ };
228
+ }
229
+ //# sourceMappingURL=session-detector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-detector.js","sourceRoot":"","sources":["../src/session-detector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAc,OAAO,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAkB,MAAM,IAAI,CAAC;AACjG,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,mB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;QACR,MAAM;QACN,IAAI;KACL,CAAC;AACJ,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Unit tests for isAgentSession() - the pure classifier used by bug-003's
3
+ * fix (issues({action:'resolve'}) must refuse autonomous agents). It only
4
+ * operates on the plain SessionState shape returned by
5
+ * SessionDetector.getState(), so it's tested directly without any real
6
+ * fs.watch/transcript-file plumbing.
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=session-detector.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-detector.test.d.ts","sourceRoot":"","sources":["../src/session-detector.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Unit tests for isAgentSession() - the pure classifier used by bug-003's
3
+ * fix (issues({action:'resolve'}) must refuse autonomous agents). It only
4
+ * operates on the plain SessionState shape returned by
5
+ * SessionDetector.getState(), so it's tested directly without any real
6
+ * fs.watch/transcript-file plumbing.
7
+ */
8
+ import { describe, it, expect } from 'vitest';
9
+ import { isAgentSession } from './session-detector.js';
10
+ function state(overrides = {}) {
11
+ return {
12
+ mainSession: null,
13
+ activeAgents: [],
14
+ entryCount: 0,
15
+ ...overrides,
16
+ };
17
+ }
18
+ describe('isAgentSession', () => {
19
+ it('classifies as agent when only an agent transcript has matched this process\'s PID', () => {
20
+ const s = state({
21
+ mainSession: null,
22
+ activeAgents: [{ agentId: 'a1', shortId: 'a1', agentFile: '/agent-a1.jsonl', startedAt: Date.now() }],
23
+ });
24
+ expect(isAgentSession(s)).toBe(true);
25
+ });
26
+ it('classifies as human when the main session transcript has matched, even with no agents', () => {
27
+ const s = state({
28
+ mainSession: { sessionId: 'm1', shortId: 'm1', sessionFile: '/m1.jsonl', detectedAt: Date.now() },
29
+ activeAgents: [],
30
+ });
31
+ expect(isAgentSession(s)).toBe(false);
32
+ });
33
+ it('prefers human when both a main session and agents are present (main session wins)', () => {
34
+ const s = state({
35
+ mainSession: { sessionId: 'm1', shortId: 'm1', sessionFile: '/m1.jsonl', detectedAt: Date.now() },
36
+ activeAgents: [{ agentId: 'a1', shortId: 'a1', agentFile: '/agent-a1.jsonl', startedAt: Date.now() }],
37
+ });
38
+ expect(isAgentSession(s)).toBe(false);
39
+ });
40
+ it('defaults to human (fails open) when nothing has been classified yet', () => {
41
+ const s = state({ mainSession: null, activeAgents: [] });
42
+ expect(isAgentSession(s)).toBe(false);
43
+ });
44
+ });
45
+ //# sourceMappingURL=session-detector.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-detector.test.js","sourceRoot":"","sources":["../src/session-detector.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAqB,MAAM,uBAAuB,CAAC;AAE1E,SAAS,KAAK,CAAC,YAAmC,EAAE;IAClD,OAAO;QACL,WAAW,EAAE,IAAI;QACjB,YAAY,EAAE,EAAE;QAChB,UAAU,EAAE,CAAC;QACb,GAAG,SAAS;KACb,CAAC;AACJ,CAAC;AAED,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,EAAE,CAAC,mFAAmF,EAAE,GAAG,EAAE;QAC3F,MAAM,CAAC,GAAG,KAAK,CAAC;YACd,WAAW,EAAE,IAAI;YACjB,YAAY,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,iBAAiB,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;SACtG,CAAC,CAAC;QACH,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uFAAuF,EAAE,GAAG,EAAE;QAC/F,MAAM,CAAC,GAAG,KAAK,CAAC;YACd,WAAW,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE;YACjG,YAAY,EAAE,EAAE;SACjB,CAAC,CAAC;QACH,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mFAAmF,EAAE,GAAG,EAAE;QAC3F,MAAM,CAAC,GAAG,KAAK,CAAC;YACd,WAAW,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE;YACjG,YAAY,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,iBAAiB,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;SACtG,CAAC,CAAC;QACH,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qEAAqE,EAAE,GAAG,EAAE;QAC7E,MAAM,CAAC,GAAG,KAAK,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC,CAAC;QACzD,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,114 @@
1
+ /**
2
+ * Source Map Handler
3
+ * Handles TypeScript to JavaScript mapping for breakpoints
4
+ */
5
+ export interface SourcePosition {
6
+ source: string;
7
+ line: number;
8
+ column: number;
9
+ }
10
+ export interface MappedPosition {
11
+ generatedLine: number;
12
+ generatedColumn: number;
13
+ originalLine: number;
14
+ originalColumn: number;
15
+ source: string;
16
+ }
17
+ interface LoadError {
18
+ scriptUrl: string;
19
+ error: string;
20
+ timestamp: number;
21
+ }
22
+ export declare class SourceMapHandler {
23
+ private sourceMaps;
24
+ private pendingSourceMaps;
25
+ private loadingPromises;
26
+ private lastErrors;
27
+ private clearing;
28
+ /**
29
+ * Register a source map URL for lazy loading (does not load immediately)
30
+ */
31
+ registerSourceMap(scriptUrl: string, sourceMapURL: string): void;
32
+ /**
33
+ * Load a source map from a file (with size limit)
34
+ */
35
+ loadSourceMap(generatedFilePath: string): Promise<void>;
36
+ /**
37
+ * Find a matching source in a source map using proper path comparison
38
+ */
39
+ private findMatchingSource;
40
+ /**
41
+ * Normalize a path for comparison
42
+ */
43
+ private normalizePath;
44
+ /**
45
+ * Map a TypeScript position to JavaScript position (for setting breakpoints)
46
+ */
47
+ mapToGenerated(originalSource: string, originalLine: number, originalColumn?: number): Promise<{
48
+ generatedFile: string;
49
+ line: number;
50
+ column: number;
51
+ } | null>;
52
+ /**
53
+ * Map a JavaScript position to TypeScript position (for displaying location)
54
+ */
55
+ mapToOriginal(generatedFile: string, generatedLine: number, generatedColumn?: number): Promise<SourcePosition | null>;
56
+ /**
57
+ * Load source map from URL or data URI (with proper concurrency handling)
58
+ */
59
+ loadSourceMapFromURL(scriptUrl: string, sourceMapURL: string): Promise<void>;
60
+ /**
61
+ * Internal: Actually load the source map
62
+ */
63
+ private doLoadSourceMap;
64
+ /**
65
+ * Parse source map JSON with error tracking
66
+ */
67
+ private parseSourceMapJSON;
68
+ /**
69
+ * Record an error for later inspection
70
+ */
71
+ private recordError;
72
+ /**
73
+ * Get recent source map loading errors (for debugging)
74
+ */
75
+ getRecentErrors(): LoadError[];
76
+ /**
77
+ * Clear error history
78
+ */
79
+ clearErrors(): void;
80
+ /**
81
+ * Register source maps from a directory for lazy loading (does NOT eagerly load)
82
+ */
83
+ registerSourceMapsFromDirectory(directory: string): Promise<number>;
84
+ /**
85
+ * Force reload a source map (clear and re-register for lazy loading)
86
+ */
87
+ forceReload(scriptUrl: string, sourceMapURL?: string): void;
88
+ /**
89
+ * Clear all loaded and pending source maps (safe for concurrent operations)
90
+ */
91
+ clear(): void;
92
+ /**
93
+ * Clear a specific source map (loaded or pending)
94
+ */
95
+ clearSourceMap(scriptUrl: string): boolean;
96
+ /**
97
+ * Get all loaded source map files
98
+ */
99
+ getLoadedSourceMaps(): string[];
100
+ /**
101
+ * Check if a source map is loaded or registered for a given file
102
+ */
103
+ hasSourceMap(file: string): boolean;
104
+ /**
105
+ * Check if a source map is actually loaded (not just registered)
106
+ */
107
+ isSourceMapLoaded(file: string): boolean;
108
+ /**
109
+ * Get all registered (pending) source map URLs
110
+ */
111
+ getPendingSourceMaps(): string[];
112
+ }
113
+ export {};
114
+ //# sourceMappingURL=sourcemap-handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sourcemap-handler.d.ts","sourceRoot":"","sources":["../src/sourcemap-handler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;CAChB;AAOD,UAAU,SAAS;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,UAAU,CAA6C;IAC/D,OAAO,CAAC,iBAAiB,CAAkC;IAC3D,OAAO,CAAC,eAAe,CAAyC;IAChE,OAAO,CAAC,UAAU,CAAmB;IACrC,OAAO,CAAC,QAAQ,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