@vforsh/argus-watcher 0.1.2 → 0.1.4

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 (355) hide show
  1. package/README.md +67 -14
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/artifacts.d.ts +13 -0
  4. package/dist/artifacts.d.ts.map +1 -0
  5. package/dist/artifacts.js +27 -0
  6. package/dist/artifacts.js.map +1 -0
  7. package/dist/buffer/LogBuffer.d.ts +8 -3
  8. package/dist/buffer/LogBuffer.d.ts.map +1 -1
  9. package/dist/buffer/LogBuffer.js +9 -1
  10. package/dist/buffer/LogBuffer.js.map +1 -1
  11. package/dist/buffer/NetBuffer.d.ts +29 -0
  12. package/dist/buffer/NetBuffer.d.ts.map +1 -0
  13. package/dist/buffer/NetBuffer.js +85 -0
  14. package/dist/buffer/NetBuffer.js.map +1 -0
  15. package/dist/cdp/accessibility.d.ts +18 -0
  16. package/dist/cdp/accessibility.d.ts.map +1 -0
  17. package/dist/cdp/accessibility.js +300 -0
  18. package/dist/cdp/accessibility.js.map +1 -0
  19. package/dist/cdp/connection.d.ts +39 -0
  20. package/dist/cdp/connection.d.ts.map +1 -0
  21. package/dist/cdp/connection.js +131 -0
  22. package/dist/cdp/connection.js.map +1 -0
  23. package/dist/cdp/dom/fill.d.ts +22 -0
  24. package/dist/cdp/dom/fill.d.ts.map +1 -0
  25. package/dist/cdp/dom/fill.js +59 -0
  26. package/dist/cdp/dom/fill.js.map +1 -0
  27. package/dist/cdp/dom/info.d.ts +14 -0
  28. package/dist/cdp/dom/info.d.ts.map +1 -0
  29. package/dist/cdp/dom/info.js +52 -0
  30. package/dist/cdp/dom/info.js.map +1 -0
  31. package/dist/cdp/dom/insert.d.ts +19 -0
  32. package/dist/cdp/dom/insert.d.ts.map +1 -0
  33. package/dist/cdp/dom/insert.js +30 -0
  34. package/dist/cdp/dom/insert.js.map +1 -0
  35. package/dist/cdp/dom/modify.d.ts +50 -0
  36. package/dist/cdp/dom/modify.d.ts.map +1 -0
  37. package/dist/cdp/dom/modify.js +100 -0
  38. package/dist/cdp/dom/modify.js.map +1 -0
  39. package/dist/cdp/dom/remove.d.ts +17 -0
  40. package/dist/cdp/dom/remove.d.ts.map +1 -0
  41. package/dist/cdp/dom/remove.js +27 -0
  42. package/dist/cdp/dom/remove.js.map +1 -0
  43. package/dist/cdp/dom/selector.d.ts +19 -0
  44. package/dist/cdp/dom/selector.d.ts.map +1 -0
  45. package/dist/cdp/dom/selector.js +86 -0
  46. package/dist/cdp/dom/selector.js.map +1 -0
  47. package/dist/cdp/dom/setFile.d.ts +21 -0
  48. package/dist/cdp/dom/setFile.d.ts.map +1 -0
  49. package/dist/cdp/dom/setFile.js +25 -0
  50. package/dist/cdp/dom/setFile.js.map +1 -0
  51. package/dist/cdp/dom/submit.d.ts +15 -0
  52. package/dist/cdp/dom/submit.d.ts.map +1 -0
  53. package/dist/cdp/dom/submit.js +130 -0
  54. package/dist/cdp/dom/submit.js.map +1 -0
  55. package/dist/cdp/dom/tree.d.ts +16 -0
  56. package/dist/cdp/dom/tree.d.ts.map +1 -0
  57. package/dist/cdp/dom/tree.js +100 -0
  58. package/dist/cdp/dom/tree.js.map +1 -0
  59. package/dist/cdp/dom/types.d.ts +15 -0
  60. package/dist/cdp/dom/types.d.ts.map +1 -0
  61. package/dist/cdp/dom/types.js +2 -0
  62. package/dist/cdp/dom/types.js.map +1 -0
  63. package/dist/cdp/dom.d.ts +15 -0
  64. package/dist/cdp/dom.d.ts.map +1 -0
  65. package/dist/cdp/dom.js +9 -0
  66. package/dist/cdp/dom.js.map +1 -0
  67. package/dist/cdp/editor.d.ts +23 -0
  68. package/dist/cdp/editor.d.ts.map +1 -0
  69. package/dist/cdp/editor.js +266 -0
  70. package/dist/cdp/editor.js.map +1 -0
  71. package/dist/cdp/emulation.d.ts +16 -0
  72. package/dist/cdp/emulation.d.ts.map +1 -0
  73. package/dist/cdp/emulation.js +40 -0
  74. package/dist/cdp/emulation.js.map +1 -0
  75. package/dist/cdp/eval.d.ts +11 -0
  76. package/dist/cdp/eval.d.ts.map +1 -0
  77. package/dist/cdp/eval.js +79 -0
  78. package/dist/cdp/eval.js.map +1 -0
  79. package/dist/cdp/keyboard.d.ts +38 -0
  80. package/dist/cdp/keyboard.d.ts.map +1 -0
  81. package/dist/cdp/keyboard.js +148 -0
  82. package/dist/cdp/keyboard.js.map +1 -0
  83. package/dist/cdp/mouse.d.ts +49 -0
  84. package/dist/cdp/mouse.d.ts.map +1 -0
  85. package/dist/cdp/mouse.js +203 -0
  86. package/dist/cdp/mouse.js.map +1 -0
  87. package/dist/cdp/networkCapture.d.ts +11 -0
  88. package/dist/cdp/networkCapture.d.ts.map +1 -0
  89. package/dist/cdp/networkCapture.js +99 -0
  90. package/dist/cdp/networkCapture.js.map +1 -0
  91. package/dist/cdp/pageIndicator.d.ts +41 -0
  92. package/dist/cdp/pageIndicator.d.ts.map +1 -0
  93. package/dist/cdp/pageIndicator.js +395 -0
  94. package/dist/cdp/pageIndicator.js.map +1 -0
  95. package/dist/cdp/redaction.d.ts +3 -0
  96. package/dist/cdp/redaction.d.ts.map +1 -0
  97. package/dist/cdp/redaction.js +35 -0
  98. package/dist/cdp/redaction.js.map +1 -0
  99. package/dist/cdp/remoteObject.d.ts +6 -0
  100. package/dist/cdp/remoteObject.d.ts.map +1 -0
  101. package/dist/cdp/remoteObject.js +94 -0
  102. package/dist/cdp/remoteObject.js.map +1 -0
  103. package/dist/cdp/screenshot.d.ts +10 -0
  104. package/dist/cdp/screenshot.d.ts.map +1 -0
  105. package/dist/cdp/screenshot.js +83 -0
  106. package/dist/cdp/screenshot.js.map +1 -0
  107. package/dist/cdp/storageLocal.d.ts +8 -0
  108. package/dist/cdp/storageLocal.d.ts.map +1 -0
  109. package/dist/cdp/storageLocal.js +70 -0
  110. package/dist/cdp/storageLocal.js.map +1 -0
  111. package/dist/cdp/text-filter.d.ts +6 -0
  112. package/dist/cdp/text-filter.d.ts.map +1 -0
  113. package/dist/cdp/text-filter.js +36 -0
  114. package/dist/cdp/text-filter.js.map +1 -0
  115. package/dist/cdp/throttle.d.ts +6 -0
  116. package/dist/cdp/throttle.d.ts.map +1 -0
  117. package/dist/cdp/throttle.js +9 -0
  118. package/dist/cdp/throttle.js.map +1 -0
  119. package/dist/cdp/tracing.d.ts +15 -0
  120. package/dist/cdp/tracing.d.ts.map +1 -0
  121. package/dist/cdp/tracing.js +159 -0
  122. package/dist/cdp/tracing.js.map +1 -0
  123. package/dist/cdp/watcher.d.ts +17 -2
  124. package/dist/cdp/watcher.d.ts.map +1 -1
  125. package/dist/cdp/watcher.js +124 -175
  126. package/dist/cdp/watcher.js.map +1 -1
  127. package/dist/emulation/EmulationController.d.ts +12 -0
  128. package/dist/emulation/EmulationController.d.ts.map +1 -0
  129. package/dist/emulation/EmulationController.js +83 -0
  130. package/dist/emulation/EmulationController.js.map +1 -0
  131. package/dist/events.d.ts +86 -0
  132. package/dist/events.d.ts.map +1 -0
  133. package/dist/events.js +2 -0
  134. package/dist/events.js.map +1 -0
  135. package/dist/fileLogs/WatcherFileLogger.d.ts +5 -2
  136. package/dist/fileLogs/WatcherFileLogger.d.ts.map +1 -1
  137. package/dist/fileLogs/WatcherFileLogger.js +30 -12
  138. package/dist/fileLogs/WatcherFileLogger.js.map +1 -1
  139. package/dist/http/httpUtils.d.ts +25 -0
  140. package/dist/http/httpUtils.d.ts.map +1 -0
  141. package/dist/http/httpUtils.js +170 -0
  142. package/dist/http/httpUtils.js.map +1 -0
  143. package/dist/http/router.d.ts +5 -0
  144. package/dist/http/router.d.ts.map +1 -0
  145. package/dist/http/router.js +85 -0
  146. package/dist/http/router.js.map +1 -0
  147. package/dist/http/routes/getEmulation.d.ts +3 -0
  148. package/dist/http/routes/getEmulation.d.ts.map +1 -0
  149. package/dist/http/routes/getEmulation.js +8 -0
  150. package/dist/http/routes/getEmulation.js.map +1 -0
  151. package/dist/http/routes/getLogs.d.ts +3 -0
  152. package/dist/http/routes/getLogs.d.ts.map +1 -0
  153. package/dist/http/routes/getLogs.js +28 -0
  154. package/dist/http/routes/getLogs.js.map +1 -0
  155. package/dist/http/routes/getNet.d.ts +3 -0
  156. package/dist/http/routes/getNet.d.ts.map +1 -0
  157. package/dist/http/routes/getNet.js +17 -0
  158. package/dist/http/routes/getNet.js.map +1 -0
  159. package/dist/http/routes/getNetTail.d.ts +3 -0
  160. package/dist/http/routes/getNetTail.d.ts.map +1 -0
  161. package/dist/http/routes/getNetTail.js +18 -0
  162. package/dist/http/routes/getNetTail.js.map +1 -0
  163. package/dist/http/routes/getStatus.d.ts +3 -0
  164. package/dist/http/routes/getStatus.d.ts.map +1 -0
  165. package/dist/http/routes/getStatus.js +21 -0
  166. package/dist/http/routes/getStatus.js.map +1 -0
  167. package/dist/http/routes/getTail.d.ts +3 -0
  168. package/dist/http/routes/getTail.d.ts.map +1 -0
  169. package/dist/http/routes/getTail.js +28 -0
  170. package/dist/http/routes/getTail.js.map +1 -0
  171. package/dist/http/routes/getTargets.d.ts +3 -0
  172. package/dist/http/routes/getTargets.d.ts.map +1 -0
  173. package/dist/http/routes/getTargets.js +16 -0
  174. package/dist/http/routes/getTargets.js.map +1 -0
  175. package/dist/http/routes/getThrottle.d.ts +3 -0
  176. package/dist/http/routes/getThrottle.d.ts.map +1 -0
  177. package/dist/http/routes/getThrottle.js +8 -0
  178. package/dist/http/routes/getThrottle.js.map +1 -0
  179. package/dist/http/routes/postAttach.d.ts +3 -0
  180. package/dist/http/routes/postAttach.d.ts.map +1 -0
  181. package/dist/http/routes/postAttach.js +24 -0
  182. package/dist/http/routes/postAttach.js.map +1 -0
  183. package/dist/http/routes/postCodeEdit.d.ts +3 -0
  184. package/dist/http/routes/postCodeEdit.d.ts.map +1 -0
  185. package/dist/http/routes/postCodeEdit.js +32 -0
  186. package/dist/http/routes/postCodeEdit.js.map +1 -0
  187. package/dist/http/routes/postCodeGrep.d.ts +3 -0
  188. package/dist/http/routes/postCodeGrep.d.ts.map +1 -0
  189. package/dist/http/routes/postCodeGrep.js +26 -0
  190. package/dist/http/routes/postCodeGrep.js.map +1 -0
  191. package/dist/http/routes/postCodeList.d.ts +3 -0
  192. package/dist/http/routes/postCodeList.d.ts.map +1 -0
  193. package/dist/http/routes/postCodeList.js +20 -0
  194. package/dist/http/routes/postCodeList.js.map +1 -0
  195. package/dist/http/routes/postCodeRead.d.ts +3 -0
  196. package/dist/http/routes/postCodeRead.d.ts.map +1 -0
  197. package/dist/http/routes/postCodeRead.js +30 -0
  198. package/dist/http/routes/postCodeRead.js.map +1 -0
  199. package/dist/http/routes/postDetach.d.ts +3 -0
  200. package/dist/http/routes/postDetach.d.ts.map +1 -0
  201. package/dist/http/routes/postDetach.js +24 -0
  202. package/dist/http/routes/postDetach.js.map +1 -0
  203. package/dist/http/routes/postDomAdd.d.ts +7 -0
  204. package/dist/http/routes/postDomAdd.d.ts.map +1 -0
  205. package/dist/http/routes/postDomAdd.js +97 -0
  206. package/dist/http/routes/postDomAdd.js.map +1 -0
  207. package/dist/http/routes/postDomClick.d.ts +3 -0
  208. package/dist/http/routes/postDomClick.d.ts.map +1 -0
  209. package/dist/http/routes/postDomClick.js +85 -0
  210. package/dist/http/routes/postDomClick.js.map +1 -0
  211. package/dist/http/routes/postDomFill.d.ts +3 -0
  212. package/dist/http/routes/postDomFill.d.ts.map +1 -0
  213. package/dist/http/routes/postDomFill.js +58 -0
  214. package/dist/http/routes/postDomFill.js.map +1 -0
  215. package/dist/http/routes/postDomFocus.d.ts +3 -0
  216. package/dist/http/routes/postDomFocus.d.ts.map +1 -0
  217. package/dist/http/routes/postDomFocus.js +40 -0
  218. package/dist/http/routes/postDomFocus.js.map +1 -0
  219. package/dist/http/routes/postDomHover.d.ts +3 -0
  220. package/dist/http/routes/postDomHover.d.ts.map +1 -0
  221. package/dist/http/routes/postDomHover.js +40 -0
  222. package/dist/http/routes/postDomHover.js.map +1 -0
  223. package/dist/http/routes/postDomInfo.d.ts +3 -0
  224. package/dist/http/routes/postDomInfo.d.ts.map +1 -0
  225. package/dist/http/routes/postDomInfo.js +40 -0
  226. package/dist/http/routes/postDomInfo.js.map +1 -0
  227. package/dist/http/routes/postDomKeydown.d.ts +3 -0
  228. package/dist/http/routes/postDomKeydown.d.ts.map +1 -0
  229. package/dist/http/routes/postDomKeydown.js +36 -0
  230. package/dist/http/routes/postDomKeydown.js.map +1 -0
  231. package/dist/http/routes/postDomModify.d.ts +3 -0
  232. package/dist/http/routes/postDomModify.d.ts.map +1 -0
  233. package/dist/http/routes/postDomModify.js +45 -0
  234. package/dist/http/routes/postDomModify.js.map +1 -0
  235. package/dist/http/routes/postDomRemove.d.ts +3 -0
  236. package/dist/http/routes/postDomRemove.d.ts.map +1 -0
  237. package/dist/http/routes/postDomRemove.js +39 -0
  238. package/dist/http/routes/postDomRemove.js.map +1 -0
  239. package/dist/http/routes/postDomScroll.d.ts +3 -0
  240. package/dist/http/routes/postDomScroll.d.ts.map +1 -0
  241. package/dist/http/routes/postDomScroll.js +75 -0
  242. package/dist/http/routes/postDomScroll.js.map +1 -0
  243. package/dist/http/routes/postDomScrollTo.d.ts +3 -0
  244. package/dist/http/routes/postDomScrollTo.d.ts.map +1 -0
  245. package/dist/http/routes/postDomScrollTo.js +69 -0
  246. package/dist/http/routes/postDomScrollTo.js.map +1 -0
  247. package/dist/http/routes/postDomSetFile.d.ts +3 -0
  248. package/dist/http/routes/postDomSetFile.d.ts.map +1 -0
  249. package/dist/http/routes/postDomSetFile.js +58 -0
  250. package/dist/http/routes/postDomSetFile.js.map +1 -0
  251. package/dist/http/routes/postDomSubmit.d.ts +3 -0
  252. package/dist/http/routes/postDomSubmit.d.ts.map +1 -0
  253. package/dist/http/routes/postDomSubmit.js +49 -0
  254. package/dist/http/routes/postDomSubmit.js.map +1 -0
  255. package/dist/http/routes/postDomTree.d.ts +3 -0
  256. package/dist/http/routes/postDomTree.d.ts.map +1 -0
  257. package/dist/http/routes/postDomTree.js +41 -0
  258. package/dist/http/routes/postDomTree.js.map +1 -0
  259. package/dist/http/routes/postEmulation.d.ts +3 -0
  260. package/dist/http/routes/postEmulation.d.ts.map +1 -0
  261. package/dist/http/routes/postEmulation.js +70 -0
  262. package/dist/http/routes/postEmulation.js.map +1 -0
  263. package/dist/http/routes/postEval.d.ts +3 -0
  264. package/dist/http/routes/postEval.d.ts.map +1 -0
  265. package/dist/http/routes/postEval.js +27 -0
  266. package/dist/http/routes/postEval.js.map +1 -0
  267. package/dist/http/routes/postReload.d.ts +3 -0
  268. package/dist/http/routes/postReload.d.ts.map +1 -0
  269. package/dist/http/routes/postReload.js +20 -0
  270. package/dist/http/routes/postReload.js.map +1 -0
  271. package/dist/http/routes/postScreenshot.d.ts +3 -0
  272. package/dist/http/routes/postScreenshot.d.ts.map +1 -0
  273. package/dist/http/routes/postScreenshot.js +17 -0
  274. package/dist/http/routes/postScreenshot.js.map +1 -0
  275. package/dist/http/routes/postShutdown.d.ts +3 -0
  276. package/dist/http/routes/postShutdown.d.ts.map +1 -0
  277. package/dist/http/routes/postShutdown.js +13 -0
  278. package/dist/http/routes/postShutdown.js.map +1 -0
  279. package/dist/http/routes/postSnapshot.d.ts +3 -0
  280. package/dist/http/routes/postSnapshot.d.ts.map +1 -0
  281. package/dist/http/routes/postSnapshot.js +28 -0
  282. package/dist/http/routes/postSnapshot.js.map +1 -0
  283. package/dist/http/routes/postStorageLocal.d.ts +3 -0
  284. package/dist/http/routes/postStorageLocal.d.ts.map +1 -0
  285. package/dist/http/routes/postStorageLocal.js +31 -0
  286. package/dist/http/routes/postStorageLocal.js.map +1 -0
  287. package/dist/http/routes/postThrottle.d.ts +3 -0
  288. package/dist/http/routes/postThrottle.d.ts.map +1 -0
  289. package/dist/http/routes/postThrottle.js +38 -0
  290. package/dist/http/routes/postThrottle.js.map +1 -0
  291. package/dist/http/routes/postTraceStart.d.ts +3 -0
  292. package/dist/http/routes/postTraceStart.d.ts.map +1 -0
  293. package/dist/http/routes/postTraceStart.js +17 -0
  294. package/dist/http/routes/postTraceStart.js.map +1 -0
  295. package/dist/http/routes/postTraceStop.d.ts +3 -0
  296. package/dist/http/routes/postTraceStop.d.ts.map +1 -0
  297. package/dist/http/routes/postTraceStop.js +17 -0
  298. package/dist/http/routes/postTraceStop.js.map +1 -0
  299. package/dist/http/routes/types.d.ts +9 -0
  300. package/dist/http/routes/types.d.ts.map +1 -0
  301. package/dist/http/routes/types.js +10 -0
  302. package/dist/http/routes/types.js.map +1 -0
  303. package/dist/http/server.d.ts +42 -1
  304. package/dist/http/server.d.ts.map +1 -1
  305. package/dist/http/server.js +3 -82
  306. package/dist/http/server.js.map +1 -1
  307. package/dist/index.d.ts +117 -14
  308. package/dist/index.d.ts.map +1 -1
  309. package/dist/index.js +349 -44
  310. package/dist/index.js.map +1 -1
  311. package/dist/native-messaging/messaging.d.ts +18 -0
  312. package/dist/native-messaging/messaging.d.ts.map +1 -0
  313. package/dist/native-messaging/messaging.js +94 -0
  314. package/dist/native-messaging/messaging.js.map +1 -0
  315. package/dist/native-messaging/session-manager.d.ts +108 -0
  316. package/dist/native-messaging/session-manager.d.ts.map +1 -0
  317. package/dist/native-messaging/session-manager.js +267 -0
  318. package/dist/native-messaging/session-manager.js.map +1 -0
  319. package/dist/native-messaging/types.d.ts +112 -0
  320. package/dist/native-messaging/types.d.ts.map +1 -0
  321. package/dist/native-messaging/types.js +6 -0
  322. package/dist/native-messaging/types.js.map +1 -0
  323. package/dist/registry/registry.d.ts +9 -2
  324. package/dist/registry/registry.d.ts.map +1 -1
  325. package/dist/registry/registry.js +53 -9
  326. package/dist/registry/registry.js.map +1 -1
  327. package/dist/scripts/install-host.d.ts +10 -0
  328. package/dist/scripts/install-host.d.ts.map +1 -0
  329. package/dist/scripts/install-host.js +189 -0
  330. package/dist/scripts/install-host.js.map +1 -0
  331. package/dist/sources/cdp-source.d.ts +24 -0
  332. package/dist/sources/cdp-source.d.ts.map +1 -0
  333. package/dist/sources/cdp-source.js +49 -0
  334. package/dist/sources/cdp-source.js.map +1 -0
  335. package/dist/sources/extension-frame-state.d.ts +64 -0
  336. package/dist/sources/extension-frame-state.d.ts.map +1 -0
  337. package/dist/sources/extension-frame-state.js +117 -0
  338. package/dist/sources/extension-frame-state.js.map +1 -0
  339. package/dist/sources/extension-log-events.d.ts +15 -0
  340. package/dist/sources/extension-log-events.d.ts.map +1 -0
  341. package/dist/sources/extension-log-events.js +101 -0
  342. package/dist/sources/extension-log-events.js.map +1 -0
  343. package/dist/sources/extension-source.d.ts +15 -0
  344. package/dist/sources/extension-source.d.ts.map +1 -0
  345. package/dist/sources/extension-source.js +487 -0
  346. package/dist/sources/extension-source.js.map +1 -0
  347. package/dist/sources/types.d.ts +109 -0
  348. package/dist/sources/types.d.ts.map +1 -0
  349. package/dist/sources/types.js +7 -0
  350. package/dist/sources/types.js.map +1 -0
  351. package/dist/throttle/ThrottleController.d.ts +12 -0
  352. package/dist/throttle/ThrottleController.d.ts.map +1 -0
  353. package/dist/throttle/ThrottleController.js +67 -0
  354. package/dist/throttle/ThrottleController.js.map +1 -0
  355. package/package.json +3 -2
@@ -0,0 +1,487 @@
1
+ /**
2
+ * Extension source for CDP access via Chrome extension Native Messaging.
3
+ * Wraps SessionManager and provides a unified source interface.
4
+ */
5
+ import { createNativeMessaging } from '../native-messaging/messaging.js';
6
+ import { SessionManager } from '../native-messaging/session-manager.js';
7
+ import { buildFrameTargets, buildPageTarget, collectFrameTree, createEmptyFrameState, createNotAttachedError, frameToTarget, formatPageTargetId, parseExecutionContext, parseExtensionTargetId, parseFrame, resolveRequestedFrameId, } from './extension-frame-state.js';
8
+ import { toConsoleEvent, toExceptionEvent } from './extension-log-events.js';
9
+ /**
10
+ * Create an extension source that connects to Chrome via Native Messaging.
11
+ * Returns a handle that can be used to control the source and access CDP session.
12
+ */
13
+ export const createExtensionSource = (options) => {
14
+ const { events, ignoreMatcher, stripUrlPrefixes, watcherId, watcherHost, watcherPort } = options;
15
+ const messaging = createNativeMessaging();
16
+ const hostInfo = {
17
+ watcherId: watcherId ?? 'extension',
18
+ watcherHost: watcherHost ?? '127.0.0.1',
19
+ watcherPort: watcherPort ?? 0,
20
+ watcherPid: process.pid,
21
+ };
22
+ let currentSession = null;
23
+ let stopping = false;
24
+ const frameStateByTabId = new Map();
25
+ const getCurrentExtensionSession = () => {
26
+ if (!currentSession) {
27
+ throw createNotAttachedError();
28
+ }
29
+ return currentSession;
30
+ };
31
+ const sessionManager = new SessionManager(messaging, {
32
+ onAttach: (session) => {
33
+ console.error(`[ExtensionSource] Tab attached: ${session.tabId} - ${session.url}`);
34
+ currentSession = session;
35
+ seedFrameState(session);
36
+ void bootstrapAttachedSession(session);
37
+ },
38
+ onDetach: (tabId, reason) => {
39
+ console.error(`[ExtensionSource] Tab detached: ${tabId} - ${reason}`);
40
+ if (currentSession?.tabId === tabId) {
41
+ currentSession = null;
42
+ }
43
+ frameStateByTabId.delete(tabId);
44
+ emitStatus(null, reason);
45
+ events.onDetach?.(reason);
46
+ },
47
+ onTabsUpdated: () => {
48
+ // Tabs list updated - no action needed
49
+ },
50
+ onTargetSelected: (tabId, frameId) => {
51
+ const session = currentSession;
52
+ if (!session || session.tabId !== tabId) {
53
+ getOrCreateFrameState(tabId).requestedFrameId = frameId;
54
+ return;
55
+ }
56
+ requestTargetSelection(session, frameId);
57
+ },
58
+ });
59
+ // Proxy session follows the currently selected page/frame target inside the attached tab.
60
+ const proxySession = createDelegatingSession({
61
+ getTargetContext: () => getCurrentTargetContext() ?? { kind: 'page' },
62
+ mapParams: (method, params) => {
63
+ const targetContext = getCurrentTargetContext();
64
+ if (method !== 'Runtime.evaluate' || targetContext?.kind !== 'frame' || params?.contextId != null) {
65
+ return params;
66
+ }
67
+ if (targetContext.executionContextId == null) {
68
+ throw new Error(`Selected frame is not ready yet: ${targetContext.frameId}`);
69
+ }
70
+ return {
71
+ ...(params ?? {}),
72
+ contextId: targetContext.executionContextId,
73
+ };
74
+ },
75
+ });
76
+ // Page session always stays at the top-level tab context so page-level features
77
+ // (indicator, inject-on-attach, similar lifecycle hooks) don't accidentally run inside an iframe.
78
+ const pageSession = createDelegatingSession({
79
+ getTargetContext: () => ({ kind: 'page' }),
80
+ });
81
+ messaging.start();
82
+ sendHostInfo();
83
+ messaging.onDisconnect(() => {
84
+ console.error('[ExtensionSource] Extension disconnected');
85
+ if (!stopping) {
86
+ emitStatus(null, 'extension_disconnected');
87
+ events.onDetach?.('extension_disconnected');
88
+ }
89
+ });
90
+ const stop = async () => {
91
+ stopping = true;
92
+ messaging.stop();
93
+ };
94
+ const listTargets = async () => {
95
+ const tabs = await sessionManager.listTabs();
96
+ return tabs.flatMap((tab) => {
97
+ const session = currentSession?.tabId === tab.tabId ? currentSession : null;
98
+ const state = frameStateByTabId.get(tab.tabId);
99
+ if (!session || !state || state.frames.size === 0) {
100
+ return [tabToTarget(tab)];
101
+ }
102
+ const activeFrameId = state.activeFrameId;
103
+ const targets = [buildPageTarget(session, { attached: activeFrameId == null })];
104
+ for (const frame of buildFrameTargets(state, tab.tabId, activeFrameId, tab.faviconUrl)) {
105
+ targets.push(frame);
106
+ }
107
+ return targets;
108
+ });
109
+ };
110
+ const attachTarget = (targetId) => {
111
+ const target = parseExtensionTargetId(targetId);
112
+ const session = currentSession;
113
+ if (!session || session.tabId !== target.tabId) {
114
+ getOrCreateFrameState(target.tabId).requestedFrameId = target.frameId;
115
+ sessionManager.attachTab(target.tabId);
116
+ return;
117
+ }
118
+ requestTargetSelection(session, target.frameId);
119
+ };
120
+ const detachTarget = (targetId) => {
121
+ sessionManager.detachTab(parseExtensionTargetId(targetId).tabId);
122
+ };
123
+ return {
124
+ session: proxySession,
125
+ pageSession,
126
+ syncWatcherInfo: (info) => {
127
+ hostInfo.watcherId = info.watcherId;
128
+ hostInfo.watcherHost = info.watcherHost;
129
+ hostInfo.watcherPort = info.watcherPort;
130
+ hostInfo.watcherPid = info.watcherPid;
131
+ sendHostInfo();
132
+ },
133
+ stop,
134
+ listTargets,
135
+ attachTarget,
136
+ detachTarget,
137
+ };
138
+ function sendHostInfo() {
139
+ messaging.send({
140
+ type: 'host_info',
141
+ watcherId: hostInfo.watcherId,
142
+ watcherHost: hostInfo.watcherHost,
143
+ watcherPort: hostInfo.watcherPort,
144
+ pid: hostInfo.watcherPid,
145
+ });
146
+ }
147
+ async function bootstrapAttachedSession(session) {
148
+ try {
149
+ registerSessionEventHandlers(session);
150
+ await enableBootstrapDomains(session);
151
+ await refreshFrameTree(session);
152
+ if (currentSession?.tabId !== session.tabId) {
153
+ return;
154
+ }
155
+ const target = buildPageTarget(session, { attached: true });
156
+ emitStatus(target, null);
157
+ await events.onAttach?.(session.handle, target);
158
+ reconcileTargetSelection(session);
159
+ }
160
+ catch (error) {
161
+ const message = error instanceof Error ? error.message : String(error);
162
+ console.error(`[ExtensionSource] Failed to bootstrap attached tab ${session.tabId}: ${message}`);
163
+ if (currentSession?.tabId === session.tabId) {
164
+ emitStatus(null, message);
165
+ events.onDetach?.(message);
166
+ }
167
+ }
168
+ }
169
+ /**
170
+ * Subscribe before enabling Runtime/Page so we don't miss the initial execution contexts
171
+ * that Chrome emits as soon as Runtime becomes active.
172
+ */
173
+ async function enableBootstrapDomains(session) {
174
+ await session.handle.sendAndWait('Runtime.enable');
175
+ await session.handle.sendAndWait('Page.enable');
176
+ }
177
+ function registerSessionEventHandlers(session) {
178
+ session.handle.onEvent('Runtime.executionContextCreated', (params, meta) => {
179
+ const context = parseExecutionContext(params);
180
+ if (!context?.isDefault || !context.frameId) {
181
+ return;
182
+ }
183
+ const state = getOrCreateFrameState(session.tabId);
184
+ state.executionContexts.set(context.frameId, context.id);
185
+ const frame = state.frames.get(context.frameId);
186
+ if (frame) {
187
+ frame.sessionId = meta.sessionId ?? null;
188
+ }
189
+ void refreshFrameTitle(session, context.frameId, context.id);
190
+ reconcileTargetSelection(session);
191
+ });
192
+ session.handle.onEvent('Runtime.executionContextsCleared', () => {
193
+ const state = getOrCreateFrameState(session.tabId);
194
+ state.executionContexts.clear();
195
+ state.pendingTitleLoads.clear();
196
+ });
197
+ session.handle.onEvent('Runtime.executionContextDestroyed', (params) => {
198
+ const record = params;
199
+ if (record.executionContextId == null) {
200
+ return;
201
+ }
202
+ const state = getOrCreateFrameState(session.tabId);
203
+ for (const [frameId, contextId] of state.executionContexts.entries()) {
204
+ if (contextId === record.executionContextId) {
205
+ state.executionContexts.delete(frameId);
206
+ state.pendingTitleLoads.delete(frameId);
207
+ }
208
+ }
209
+ });
210
+ session.handle.onEvent('Page.frameNavigated', (params, meta) => {
211
+ const frame = parseFrame(params);
212
+ if (!frame) {
213
+ return;
214
+ }
215
+ const state = getOrCreateFrameState(session.tabId);
216
+ state.frames.set(frame.frameId, frame);
217
+ frame.sessionId = meta.sessionId ?? null;
218
+ if (!frame.parentFrameId) {
219
+ if (!meta.sessionId) {
220
+ state.topFrameId = frame.frameId;
221
+ session.url = frame.url;
222
+ }
223
+ else if (state.topFrameId == null) {
224
+ state.topFrameId = frame.parentFrameId;
225
+ }
226
+ }
227
+ else if (state.executionContexts.has(frame.frameId)) {
228
+ void refreshFrameTitle(session, frame.frameId);
229
+ }
230
+ currentSession = session;
231
+ if (!frame.parentFrameId && !meta.sessionId) {
232
+ events.onPageNavigation?.({ url: frame.url, title: session.title ?? null });
233
+ }
234
+ if (reconcileTargetSelection(session)) {
235
+ return;
236
+ }
237
+ if ((!frame.parentFrameId && state.activeFrameId == null) || state.activeFrameId === frame.frameId) {
238
+ emitTargetChanged(session);
239
+ }
240
+ });
241
+ session.handle.onEvent('Page.frameAttached', (params, meta) => {
242
+ const record = params;
243
+ if (!record.frameId) {
244
+ return;
245
+ }
246
+ const state = getOrCreateFrameState(session.tabId);
247
+ state.frames.set(record.frameId, {
248
+ frameId: record.frameId,
249
+ parentFrameId: record.parentFrameId ?? state.topFrameId ?? null,
250
+ url: '',
251
+ title: null,
252
+ sessionId: meta.sessionId ?? null,
253
+ });
254
+ reconcileTargetSelection(session);
255
+ });
256
+ session.handle.onEvent('Page.frameDetached', (params) => {
257
+ const record = params;
258
+ if (!record.frameId) {
259
+ return;
260
+ }
261
+ removeFrame(session.tabId, record.frameId);
262
+ reconcileTargetSelection(session);
263
+ });
264
+ session.handle.onEvent('Page.domContentEventFired', () => {
265
+ events.onPageLoad?.();
266
+ });
267
+ session.handle.onEvent('Runtime.consoleAPICalled', (params) => {
268
+ events.onLog(toConsoleEvent(params, session, { ignoreMatcher, stripUrlPrefixes }));
269
+ });
270
+ session.handle.onEvent('Runtime.exceptionThrown', (params) => {
271
+ events.onLog(toExceptionEvent(params, session, { ignoreMatcher, stripUrlPrefixes }));
272
+ });
273
+ }
274
+ function getCurrentTargetContext() {
275
+ const session = currentSession;
276
+ if (!session) {
277
+ return null;
278
+ }
279
+ const state = frameStateByTabId.get(session.tabId);
280
+ if (!state?.activeFrameId) {
281
+ return { kind: 'page' };
282
+ }
283
+ return {
284
+ kind: 'frame',
285
+ frameId: state.activeFrameId,
286
+ executionContextId: state.executionContexts.get(state.activeFrameId) ?? null,
287
+ sessionId: state.frames.get(state.activeFrameId)?.sessionId ?? null,
288
+ };
289
+ }
290
+ function getOrCreateFrameState(tabId) {
291
+ const existing = frameStateByTabId.get(tabId);
292
+ if (existing) {
293
+ return existing;
294
+ }
295
+ const created = createEmptyFrameState();
296
+ frameStateByTabId.set(tabId, created);
297
+ return created;
298
+ }
299
+ function seedFrameState(session) {
300
+ const state = getOrCreateFrameState(session.tabId);
301
+ if (state.frames.size > 0 || session.frames.length === 0) {
302
+ return state;
303
+ }
304
+ state.topFrameId = session.topFrameId;
305
+ for (const frame of session.frames) {
306
+ state.frames.set(frame.frameId, {
307
+ frameId: frame.frameId,
308
+ parentFrameId: frame.parentFrameId,
309
+ url: frame.url,
310
+ title: frame.title,
311
+ sessionId: frame.sessionId,
312
+ });
313
+ }
314
+ return state;
315
+ }
316
+ function emitStatus(target, reason) {
317
+ events.onStatus({
318
+ attached: Boolean(target),
319
+ target: target
320
+ ? {
321
+ title: target.title,
322
+ url: target.url,
323
+ type: target.type ?? 'page',
324
+ parentId: target.parentId ?? null,
325
+ }
326
+ : null,
327
+ reason,
328
+ });
329
+ }
330
+ function emitTargetChanged(session) {
331
+ const target = getSelectedTarget(session);
332
+ if (!target) {
333
+ return;
334
+ }
335
+ const state = getOrCreateFrameState(session.tabId);
336
+ if (state.activeAttachedAt == null) {
337
+ state.activeAttachedAt = Date.now();
338
+ }
339
+ emitStatus(target, null);
340
+ messaging.send({
341
+ type: 'target_info',
342
+ targetId: target.id,
343
+ title: target.title,
344
+ url: target.url,
345
+ attachedAt: state.activeAttachedAt,
346
+ });
347
+ events.onTargetChanged?.(session.handle, target);
348
+ }
349
+ function getSelectedTarget(session) {
350
+ const state = frameStateByTabId.get(session.tabId);
351
+ if (!state?.activeFrameId) {
352
+ return buildPageTarget(session, { attached: true });
353
+ }
354
+ const frame = state.frames.get(state.activeFrameId);
355
+ if (!frame) {
356
+ return buildPageTarget(session, { attached: true });
357
+ }
358
+ return frameToTarget(session.tabId, frame, { attached: true, faviconUrl: session.faviconUrl, topFrameId: state.topFrameId });
359
+ }
360
+ function requestTargetSelection(session, frameId) {
361
+ const state = getOrCreateFrameState(session.tabId);
362
+ state.requestedFrameId = frameId;
363
+ reconcileTargetSelection(session);
364
+ }
365
+ /**
366
+ * Popup selection can arrive before the iframe's session is fully bootstrapped.
367
+ * Keep the request pending until the frame is discovered instead of routing commands
368
+ * to the parent page and pretending the switch already happened.
369
+ */
370
+ function reconcileTargetSelection(session) {
371
+ const state = getOrCreateFrameState(session.tabId);
372
+ const nextActiveFrameId = resolveRequestedFrameId(state, state.requestedFrameId);
373
+ if (state.requestedFrameId == null) {
374
+ if (state.activeFrameId == null) {
375
+ if (state.activeAttachedAt == null) {
376
+ state.activeAttachedAt = Date.now();
377
+ emitTargetChanged(session);
378
+ return true;
379
+ }
380
+ return false;
381
+ }
382
+ state.activeFrameId = null;
383
+ state.activeAttachedAt = Date.now();
384
+ emitTargetChanged(session);
385
+ return true;
386
+ }
387
+ if (nextActiveFrameId == null || state.activeFrameId === nextActiveFrameId) {
388
+ return false;
389
+ }
390
+ state.activeFrameId = nextActiveFrameId;
391
+ state.activeAttachedAt = Date.now();
392
+ emitTargetChanged(session);
393
+ return true;
394
+ }
395
+ async function refreshFrameTree(session) {
396
+ const state = getOrCreateFrameState(session.tabId);
397
+ const frameTree = (await session.handle.sendAndWait('Page.getFrameTree'));
398
+ collectFrameTree(frameTree.frameTree, state);
399
+ await Promise.all([...state.executionContexts.keys()].map((frameId) => refreshFrameTitle(session, frameId)));
400
+ }
401
+ function removeFrame(tabId, frameId) {
402
+ const state = getOrCreateFrameState(tabId);
403
+ const childIds = [...state.frames.values()].filter((frame) => frame.parentFrameId === frameId).map((frame) => frame.frameId);
404
+ for (const childId of childIds) {
405
+ removeFrame(tabId, childId);
406
+ }
407
+ if (state.requestedFrameId === frameId) {
408
+ state.requestedFrameId = null;
409
+ }
410
+ state.frames.delete(frameId);
411
+ state.executionContexts.delete(frameId);
412
+ state.pendingTitleLoads.delete(frameId);
413
+ }
414
+ /**
415
+ * Frame tree metadata does not include the iframe document title, so we resolve it from the
416
+ * frame's default execution context and cache it alongside the rest of the frame state.
417
+ */
418
+ async function refreshFrameTitle(session, frameId, contextId) {
419
+ const state = getOrCreateFrameState(session.tabId);
420
+ if (frameId === state.topFrameId || state.pendingTitleLoads.has(frameId)) {
421
+ return;
422
+ }
423
+ const executionContextId = contextId ?? state.executionContexts.get(frameId);
424
+ if (executionContextId == null) {
425
+ return;
426
+ }
427
+ const frame = state.frames.get(frameId);
428
+ if (!frame) {
429
+ return;
430
+ }
431
+ state.pendingTitleLoads.add(frameId);
432
+ try {
433
+ const evaluated = (await session.handle.sendAndWait('Runtime.evaluate', {
434
+ expression: 'document.title',
435
+ contextId: executionContextId,
436
+ returnByValue: true,
437
+ silent: true,
438
+ }, frame.sessionId ? { sessionId: frame.sessionId } : undefined));
439
+ const title = typeof evaluated.result?.value === 'string' ? evaluated.result.value.trim() : '';
440
+ const latestFrame = state.frames.get(frameId);
441
+ if (!latestFrame) {
442
+ return;
443
+ }
444
+ latestFrame.title = title || null;
445
+ if (state.activeFrameId === frameId) {
446
+ emitTargetChanged(session);
447
+ }
448
+ }
449
+ catch {
450
+ // Ignore transient frame-title lookup failures during navigation/bootstrap.
451
+ }
452
+ finally {
453
+ state.pendingTitleLoads.delete(frameId);
454
+ }
455
+ }
456
+ function createDelegatingSession(config) {
457
+ return {
458
+ isAttached: () => currentSession?.handle.isAttached() ?? false,
459
+ sendAndWait: async (method, params, options) => {
460
+ const session = getCurrentExtensionSession();
461
+ const targetContext = config.getTargetContext();
462
+ const nextParams = config.mapParams ? config.mapParams(method, params) : params;
463
+ const nextOptions = targetContext.kind === 'frame' && targetContext.sessionId ? { ...(options ?? {}), sessionId: targetContext.sessionId } : options;
464
+ return session.handle.sendAndWait(method, nextParams, nextOptions);
465
+ },
466
+ onEvent: (method, handler) => {
467
+ if (!currentSession) {
468
+ return () => { };
469
+ }
470
+ return currentSession.handle.onEvent(method, handler);
471
+ },
472
+ getTargetContext: config.getTargetContext,
473
+ };
474
+ }
475
+ };
476
+ /**
477
+ * Convert TabInfo to CdpSourceTarget.
478
+ */
479
+ const tabToTarget = (tab) => ({
480
+ id: formatPageTargetId(tab.tabId),
481
+ title: tab.title,
482
+ url: tab.url,
483
+ type: 'page',
484
+ faviconUrl: tab.faviconUrl,
485
+ attached: tab.attached,
486
+ });
487
+ //# sourceMappingURL=extension-source.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extension-source.js","sourceRoot":"","sources":["../../src/sources/extension-source.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAA;AACxE,OAAO,EAAE,cAAc,EAAyB,MAAM,wCAAwC,CAAA;AAI9F,OAAO,EACN,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACrB,sBAAsB,EACtB,aAAa,EACb,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACtB,UAAU,EACV,uBAAuB,GAGvB,M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,GAAE,CAAC,CAAA;gBAChB,CAAC;gBACD,OAAO,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;YACtD,CAAC;YACD,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;SACzC,CAAA;IACF,CAAC;AACF,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,WAAW,GAAG,CAAC,GAAY,EAAmB,EAAE,CAAC,CAAC;IACvD,EAAE,EAAE,kBAAkB,CAAC,GAAG,CAAC,KAAK,CAAC;IACjC,KAAK,EAAE,GAAG,CAAC,KAAK;IAChB,GAAG,EAAE,GAAG,CAAC,GAAG;IACZ,IAAI,EAAE,MAAM;IACZ,UAAU,EAAE,GAAG,CAAC,UAAU;IAC1B,QAAQ,EAAE,GAAG,CAAC,QAAQ;CACtB,CAAC,CAAA"}
@@ -0,0 +1,109 @@
1
+ /**
2
+ * Source abstraction types for unified CDP and Extension modes.
3
+ * Both sources implement the same interface, allowing the watcher
4
+ * to work with either CDP WebSocket or Extension Native Messaging.
5
+ */
6
+ import type { LogEvent } from '@vforsh/argus-core';
7
+ import type { CdpSessionHandle } from '../cdp/connection.js';
8
+ /**
9
+ * Represents a CDP target (either from Chrome /json or extension tabs).
10
+ */
11
+ export type CdpSourceTarget = {
12
+ /** Target/tab ID (string for CDP, number for extension). */
13
+ id: string;
14
+ /** Page title. */
15
+ title: string;
16
+ /** Page URL. */
17
+ url: string;
18
+ /** Target type (e.g., 'page', 'iframe'). */
19
+ type?: string;
20
+ /** Parent target ID for nested targets. */
21
+ parentId?: string | null;
22
+ /** Favicon URL (extension mode only). */
23
+ faviconUrl?: string;
24
+ /** Whether the target is currently attached. */
25
+ attached?: boolean;
26
+ };
27
+ /**
28
+ * CDP attachment status.
29
+ */
30
+ export type CdpSourceStatus = {
31
+ attached: boolean;
32
+ target: {
33
+ title: string | null;
34
+ url: string | null;
35
+ type: string | null;
36
+ parentId: string | null;
37
+ } | null;
38
+ /** Best-effort reason for detachment. Null when attached. */
39
+ reason?: string | null;
40
+ };
41
+ /**
42
+ * Events emitted by a CDP source.
43
+ */
44
+ export type CdpSourceEvents = {
45
+ /** Called when a log event is captured. */
46
+ onLog: (event: Omit<LogEvent, 'id'>) => void;
47
+ /** Called when CDP status changes (attached/detached). */
48
+ onStatus: (status: CdpSourceStatus) => void;
49
+ /** Called when a session is attached to a target. */
50
+ onAttach?: (session: CdpSessionHandle, target: CdpSourceTarget) => Promise<void> | void;
51
+ /** Called when a session is detached from a target. */
52
+ onDetach?: (reason: string) => void;
53
+ /** Called on page navigation (for file log rotation). */
54
+ onPageNavigation?: (info: {
55
+ url: string;
56
+ title: string | null;
57
+ }) => void;
58
+ /** Called when the page DOM is ready after navigation. */
59
+ onPageLoad?: () => void;
60
+ /** Called when page intl info is available. */
61
+ onPageIntl?: (info: {
62
+ timezone: string | null;
63
+ locale: string | null;
64
+ }) => void;
65
+ /** Called when the attached source switches between page/frame targets without detaching. */
66
+ onTargetChanged?: (session: CdpSessionHandle, target: CdpSourceTarget) => void;
67
+ };
68
+ /**
69
+ * Handle for a running CDP source.
70
+ */
71
+ export type CdpSourceHandle = {
72
+ /** The CDP session handle for sending commands and subscribing to events. */
73
+ session: CdpSessionHandle;
74
+ /** The raw top-level page session handle, for page-scoped operations like indicators. */
75
+ pageSession?: CdpSessionHandle;
76
+ /** Sync watcher metadata after the HTTP server has its final host/port (extension mode only). */
77
+ syncWatcherInfo?: (info: {
78
+ watcherId: string;
79
+ watcherHost: string;
80
+ watcherPort: number;
81
+ watcherPid: number;
82
+ }) => void;
83
+ /** Stop the source and clean up resources. */
84
+ stop: () => Promise<void>;
85
+ /** List available targets (extension mode only). */
86
+ listTargets?: () => Promise<CdpSourceTarget[]>;
87
+ /** Attach to a specific target by ID (extension mode only). */
88
+ attachTarget?: (targetId: string) => void;
89
+ /** Detach from a specific target by ID (extension mode only). */
90
+ detachTarget?: (targetId: string) => void;
91
+ };
92
+ /**
93
+ * Options common to all CDP sources.
94
+ */
95
+ export type CdpSourceBaseOptions = {
96
+ /** Event handlers for the source. */
97
+ events: CdpSourceEvents;
98
+ /** Watcher id for source-specific metadata/events. */
99
+ watcherId?: string;
100
+ /** Watcher HTTP host for source-specific metadata/events. */
101
+ watcherHost?: string;
102
+ /** Watcher HTTP port for source-specific metadata/events. */
103
+ watcherPort?: number;
104
+ /** Optional ignore list filtering for log/exception locations. */
105
+ ignoreMatcher?: ((url: string) => boolean) | null;
106
+ /** Strip these literal prefixes from event.file for display/logging. */
107
+ stripUrlPrefixes?: string[];
108
+ };
109
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/sources/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAE5D;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC7B,4DAA4D;IAC5D,EAAE,EAAE,MAAM,CAAA;IACV,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAA;IACb,gBAAgB;IAChB,GAAG,EAAE,MAAM,CAAA;IACX,4CAA4C;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,yCAAyC;IACzC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,gDAAgD;IAChD,QAAQ,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC7B,QAAQ,EAAE,OAAO,CAAA;IACjB,MAAM,EAAE;QACP,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;QACpB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;QAClB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;QACnB,QAAQ,EAAE,MAA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jG,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;IACrH,8CAA8C;IAC9C,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IACzB,oDAAoD;IACpD,WAAW,CAAC,EAAE,MAAM,OAAO,CAAC,eAAe,EAAE,CAAC,CAAA;IAC9C,+DAA+D;IAC/D,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;IACzC,iEAAiE;IACjE,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;CACzC,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IAClC,qCAAqC;IACrC,MAAM,EAAE,eAAe,CAAA;IACvB,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,6DAA6D;IAC7D,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,6DAA6D;IAC7D,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,kEAAkE;IAClE,aAAa,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,IAAI,CAAA;IACjD,wEAAwE;IACxE,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;CAC3B,CAAA"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Source abstraction types for unified CDP and Extension modes.
3
+ * Both sources implement the same interface, allowing the watcher
4
+ * to work with either CDP WebSocket or Extension Native Messaging.
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/sources/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
@@ -0,0 +1,12 @@
1
+ import type { ThrottleStatusResponse, ThrottleSetResponse, ThrottleClearResponse } from '@vforsh/argus-core';
2
+ import type { CdpSessionHandle } from '../cdp/connection.js';
3
+ export type ThrottleController = {
4
+ getStatus: (ctx: {
5
+ attached: boolean;
6
+ }) => ThrottleStatusResponse;
7
+ setDesired: (rate: number, session: CdpSessionHandle | null) => Promise<ThrottleSetResponse>;
8
+ clearDesired: (session: CdpSessionHandle | null) => Promise<ThrottleClearResponse>;
9
+ onAttach: (session: CdpSessionHandle) => Promise<void>;
10
+ };
11
+ export declare const createThrottleController: () => ThrottleController;
12
+ //# sourceMappingURL=ThrottleController.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThrottleController.d.ts","sourceRoot":"","sources":["../../src/throttle/ThrottleController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,sBAAsB,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAC3H,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAK5D,MAAM,MAAM,kBAAkB,GAAG;IAChC,SAAS,EAAE,CAAC,GAAG,EAAE;QAAE,QAAQ,EAAE,OAAO,CAAA;KAAE,KAAK,sBAAsB,CAAA;IACjE,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,GAAG,IAAI,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAA;IAC5F,YAAY,EAAE,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI,KAAK,OAAO,CAAC,qBAAqB,CAAC,CAAA;IAClF,QAAQ,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CACtD,CAAA;AAED,eAAO,MAAM,wBAAwB,QAAO,kBAuE3C,CAAA"}