@vforsh/argus-watcher 0.1.1 → 0.1.3

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 (327) hide show
  1. package/README.md +66 -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 +24 -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 +64 -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 +82 -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 +16 -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 +17 -0
  64. package/dist/cdp/dom.d.ts.map +1 -0
  65. package/dist/cdp/dom.js +10 -0
  66. package/dist/cdp/dom.js.map +1 -0
  67. package/dist/cdp/emulation.d.ts +16 -0
  68. package/dist/cdp/emulation.d.ts.map +1 -0
  69. package/dist/cdp/emulation.js +40 -0
  70. package/dist/cdp/emulation.js.map +1 -0
  71. package/dist/cdp/eval.d.ts +10 -0
  72. package/dist/cdp/eval.d.ts.map +1 -0
  73. package/dist/cdp/eval.js +34 -0
  74. package/dist/cdp/eval.js.map +1 -0
  75. package/dist/cdp/keyboard.d.ts +38 -0
  76. package/dist/cdp/keyboard.d.ts.map +1 -0
  77. package/dist/cdp/keyboard.js +148 -0
  78. package/dist/cdp/keyboard.js.map +1 -0
  79. package/dist/cdp/mouse.d.ts +49 -0
  80. package/dist/cdp/mouse.d.ts.map +1 -0
  81. package/dist/cdp/mouse.js +199 -0
  82. package/dist/cdp/mouse.js.map +1 -0
  83. package/dist/cdp/networkCapture.d.ts +11 -0
  84. package/dist/cdp/networkCapture.d.ts.map +1 -0
  85. package/dist/cdp/networkCapture.js +99 -0
  86. package/dist/cdp/networkCapture.js.map +1 -0
  87. package/dist/cdp/pageIndicator.d.ts +41 -0
  88. package/dist/cdp/pageIndicator.d.ts.map +1 -0
  89. package/dist/cdp/pageIndicator.js +395 -0
  90. package/dist/cdp/pageIndicator.js.map +1 -0
  91. package/dist/cdp/redaction.d.ts +3 -0
  92. package/dist/cdp/redaction.d.ts.map +1 -0
  93. package/dist/cdp/redaction.js +35 -0
  94. package/dist/cdp/redaction.js.map +1 -0
  95. package/dist/cdp/remoteObject.d.ts +6 -0
  96. package/dist/cdp/remoteObject.d.ts.map +1 -0
  97. package/dist/cdp/remoteObject.js +94 -0
  98. package/dist/cdp/remoteObject.js.map +1 -0
  99. package/dist/cdp/screenshot.d.ts +10 -0
  100. package/dist/cdp/screenshot.d.ts.map +1 -0
  101. package/dist/cdp/screenshot.js +87 -0
  102. package/dist/cdp/screenshot.js.map +1 -0
  103. package/dist/cdp/storageLocal.d.ts +8 -0
  104. package/dist/cdp/storageLocal.d.ts.map +1 -0
  105. package/dist/cdp/storageLocal.js +70 -0
  106. package/dist/cdp/storageLocal.js.map +1 -0
  107. package/dist/cdp/text-filter.d.ts +19 -0
  108. package/dist/cdp/text-filter.d.ts.map +1 -0
  109. package/dist/cdp/text-filter.js +54 -0
  110. package/dist/cdp/text-filter.js.map +1 -0
  111. package/dist/cdp/throttle.d.ts +6 -0
  112. package/dist/cdp/throttle.d.ts.map +1 -0
  113. package/dist/cdp/throttle.js +9 -0
  114. package/dist/cdp/throttle.js.map +1 -0
  115. package/dist/cdp/tracing.d.ts +14 -0
  116. package/dist/cdp/tracing.d.ts.map +1 -0
  117. package/dist/cdp/tracing.js +115 -0
  118. package/dist/cdp/tracing.js.map +1 -0
  119. package/dist/cdp/watcher.d.ts +17 -2
  120. package/dist/cdp/watcher.d.ts.map +1 -1
  121. package/dist/cdp/watcher.js +125 -99
  122. package/dist/cdp/watcher.js.map +1 -1
  123. package/dist/emulation/EmulationController.d.ts +12 -0
  124. package/dist/emulation/EmulationController.d.ts.map +1 -0
  125. package/dist/emulation/EmulationController.js +83 -0
  126. package/dist/emulation/EmulationController.js.map +1 -0
  127. package/dist/events.d.ts +86 -0
  128. package/dist/events.d.ts.map +1 -0
  129. package/dist/events.js +2 -0
  130. package/dist/events.js.map +1 -0
  131. package/dist/fileLogs/WatcherFileLogger.d.ts +5 -2
  132. package/dist/fileLogs/WatcherFileLogger.d.ts.map +1 -1
  133. package/dist/fileLogs/WatcherFileLogger.js +30 -12
  134. package/dist/fileLogs/WatcherFileLogger.js.map +1 -1
  135. package/dist/http/httpUtils.d.ts +25 -0
  136. package/dist/http/httpUtils.d.ts.map +1 -0
  137. package/dist/http/httpUtils.js +170 -0
  138. package/dist/http/httpUtils.js.map +1 -0
  139. package/dist/http/router.d.ts +5 -0
  140. package/dist/http/router.d.ts.map +1 -0
  141. package/dist/http/router.js +81 -0
  142. package/dist/http/router.js.map +1 -0
  143. package/dist/http/routes/getEmulation.d.ts +3 -0
  144. package/dist/http/routes/getEmulation.d.ts.map +1 -0
  145. package/dist/http/routes/getEmulation.js +8 -0
  146. package/dist/http/routes/getEmulation.js.map +1 -0
  147. package/dist/http/routes/getLogs.d.ts +3 -0
  148. package/dist/http/routes/getLogs.d.ts.map +1 -0
  149. package/dist/http/routes/getLogs.js +28 -0
  150. package/dist/http/routes/getLogs.js.map +1 -0
  151. package/dist/http/routes/getNet.d.ts +3 -0
  152. package/dist/http/routes/getNet.d.ts.map +1 -0
  153. package/dist/http/routes/getNet.js +17 -0
  154. package/dist/http/routes/getNet.js.map +1 -0
  155. package/dist/http/routes/getNetTail.d.ts +3 -0
  156. package/dist/http/routes/getNetTail.d.ts.map +1 -0
  157. package/dist/http/routes/getNetTail.js +18 -0
  158. package/dist/http/routes/getNetTail.js.map +1 -0
  159. package/dist/http/routes/getStatus.d.ts +3 -0
  160. package/dist/http/routes/getStatus.d.ts.map +1 -0
  161. package/dist/http/routes/getStatus.js +21 -0
  162. package/dist/http/routes/getStatus.js.map +1 -0
  163. package/dist/http/routes/getTail.d.ts +3 -0
  164. package/dist/http/routes/getTail.d.ts.map +1 -0
  165. package/dist/http/routes/getTail.js +28 -0
  166. package/dist/http/routes/getTail.js.map +1 -0
  167. package/dist/http/routes/getTargets.d.ts +3 -0
  168. package/dist/http/routes/getTargets.d.ts.map +1 -0
  169. package/dist/http/routes/getTargets.js +16 -0
  170. package/dist/http/routes/getTargets.js.map +1 -0
  171. package/dist/http/routes/getThrottle.d.ts +3 -0
  172. package/dist/http/routes/getThrottle.d.ts.map +1 -0
  173. package/dist/http/routes/getThrottle.js +8 -0
  174. package/dist/http/routes/getThrottle.js.map +1 -0
  175. package/dist/http/routes/postAttach.d.ts +3 -0
  176. package/dist/http/routes/postAttach.d.ts.map +1 -0
  177. package/dist/http/routes/postAttach.js +23 -0
  178. package/dist/http/routes/postAttach.js.map +1 -0
  179. package/dist/http/routes/postDetach.d.ts +3 -0
  180. package/dist/http/routes/postDetach.d.ts.map +1 -0
  181. package/dist/http/routes/postDetach.js +23 -0
  182. package/dist/http/routes/postDetach.js.map +1 -0
  183. package/dist/http/routes/postDomAdd.d.ts +7 -0
  184. package/dist/http/routes/postDomAdd.d.ts.map +1 -0
  185. package/dist/http/routes/postDomAdd.js +97 -0
  186. package/dist/http/routes/postDomAdd.js.map +1 -0
  187. package/dist/http/routes/postDomClick.d.ts +3 -0
  188. package/dist/http/routes/postDomClick.d.ts.map +1 -0
  189. package/dist/http/routes/postDomClick.js +85 -0
  190. package/dist/http/routes/postDomClick.js.map +1 -0
  191. package/dist/http/routes/postDomFill.d.ts +3 -0
  192. package/dist/http/routes/postDomFill.d.ts.map +1 -0
  193. package/dist/http/routes/postDomFill.js +58 -0
  194. package/dist/http/routes/postDomFill.js.map +1 -0
  195. package/dist/http/routes/postDomFocus.d.ts +3 -0
  196. package/dist/http/routes/postDomFocus.d.ts.map +1 -0
  197. package/dist/http/routes/postDomFocus.js +40 -0
  198. package/dist/http/routes/postDomFocus.js.map +1 -0
  199. package/dist/http/routes/postDomHover.d.ts +3 -0
  200. package/dist/http/routes/postDomHover.d.ts.map +1 -0
  201. package/dist/http/routes/postDomHover.js +40 -0
  202. package/dist/http/routes/postDomHover.js.map +1 -0
  203. package/dist/http/routes/postDomInfo.d.ts +3 -0
  204. package/dist/http/routes/postDomInfo.d.ts.map +1 -0
  205. package/dist/http/routes/postDomInfo.js +40 -0
  206. package/dist/http/routes/postDomInfo.js.map +1 -0
  207. package/dist/http/routes/postDomKeydown.d.ts +3 -0
  208. package/dist/http/routes/postDomKeydown.d.ts.map +1 -0
  209. package/dist/http/routes/postDomKeydown.js +36 -0
  210. package/dist/http/routes/postDomKeydown.js.map +1 -0
  211. package/dist/http/routes/postDomModify.d.ts +3 -0
  212. package/dist/http/routes/postDomModify.d.ts.map +1 -0
  213. package/dist/http/routes/postDomModify.js +45 -0
  214. package/dist/http/routes/postDomModify.js.map +1 -0
  215. package/dist/http/routes/postDomRemove.d.ts +3 -0
  216. package/dist/http/routes/postDomRemove.d.ts.map +1 -0
  217. package/dist/http/routes/postDomRemove.js +39 -0
  218. package/dist/http/routes/postDomRemove.js.map +1 -0
  219. package/dist/http/routes/postDomScroll.d.ts +3 -0
  220. package/dist/http/routes/postDomScroll.d.ts.map +1 -0
  221. package/dist/http/routes/postDomScroll.js +75 -0
  222. package/dist/http/routes/postDomScroll.js.map +1 -0
  223. package/dist/http/routes/postDomScrollTo.d.ts +3 -0
  224. package/dist/http/routes/postDomScrollTo.d.ts.map +1 -0
  225. package/dist/http/routes/postDomScrollTo.js +69 -0
  226. package/dist/http/routes/postDomScrollTo.js.map +1 -0
  227. package/dist/http/routes/postDomSetFile.d.ts +3 -0
  228. package/dist/http/routes/postDomSetFile.d.ts.map +1 -0
  229. package/dist/http/routes/postDomSetFile.js +67 -0
  230. package/dist/http/routes/postDomSetFile.js.map +1 -0
  231. package/dist/http/routes/postDomSubmit.d.ts +3 -0
  232. package/dist/http/routes/postDomSubmit.d.ts.map +1 -0
  233. package/dist/http/routes/postDomSubmit.js +49 -0
  234. package/dist/http/routes/postDomSubmit.js.map +1 -0
  235. package/dist/http/routes/postDomTree.d.ts +3 -0
  236. package/dist/http/routes/postDomTree.d.ts.map +1 -0
  237. package/dist/http/routes/postDomTree.js +41 -0
  238. package/dist/http/routes/postDomTree.js.map +1 -0
  239. package/dist/http/routes/postEmulation.d.ts +3 -0
  240. package/dist/http/routes/postEmulation.d.ts.map +1 -0
  241. package/dist/http/routes/postEmulation.js +70 -0
  242. package/dist/http/routes/postEmulation.js.map +1 -0
  243. package/dist/http/routes/postEval.d.ts +3 -0
  244. package/dist/http/routes/postEval.d.ts.map +1 -0
  245. package/dist/http/routes/postEval.js +26 -0
  246. package/dist/http/routes/postEval.js.map +1 -0
  247. package/dist/http/routes/postReload.d.ts +3 -0
  248. package/dist/http/routes/postReload.d.ts.map +1 -0
  249. package/dist/http/routes/postReload.js +20 -0
  250. package/dist/http/routes/postReload.js.map +1 -0
  251. package/dist/http/routes/postScreenshot.d.ts +3 -0
  252. package/dist/http/routes/postScreenshot.d.ts.map +1 -0
  253. package/dist/http/routes/postScreenshot.js +17 -0
  254. package/dist/http/routes/postScreenshot.js.map +1 -0
  255. package/dist/http/routes/postShutdown.d.ts +3 -0
  256. package/dist/http/routes/postShutdown.d.ts.map +1 -0
  257. package/dist/http/routes/postShutdown.js +13 -0
  258. package/dist/http/routes/postShutdown.js.map +1 -0
  259. package/dist/http/routes/postSnapshot.d.ts +3 -0
  260. package/dist/http/routes/postSnapshot.d.ts.map +1 -0
  261. package/dist/http/routes/postSnapshot.js +28 -0
  262. package/dist/http/routes/postSnapshot.js.map +1 -0
  263. package/dist/http/routes/postStorageLocal.d.ts +3 -0
  264. package/dist/http/routes/postStorageLocal.d.ts.map +1 -0
  265. package/dist/http/routes/postStorageLocal.js +31 -0
  266. package/dist/http/routes/postStorageLocal.js.map +1 -0
  267. package/dist/http/routes/postThrottle.d.ts +3 -0
  268. package/dist/http/routes/postThrottle.d.ts.map +1 -0
  269. package/dist/http/routes/postThrottle.js +38 -0
  270. package/dist/http/routes/postThrottle.js.map +1 -0
  271. package/dist/http/routes/postTraceStart.d.ts +3 -0
  272. package/dist/http/routes/postTraceStart.d.ts.map +1 -0
  273. package/dist/http/routes/postTraceStart.js +17 -0
  274. package/dist/http/routes/postTraceStart.js.map +1 -0
  275. package/dist/http/routes/postTraceStop.d.ts +3 -0
  276. package/dist/http/routes/postTraceStop.d.ts.map +1 -0
  277. package/dist/http/routes/postTraceStop.js +17 -0
  278. package/dist/http/routes/postTraceStop.js.map +1 -0
  279. package/dist/http/routes/types.d.ts +9 -0
  280. package/dist/http/routes/types.d.ts.map +1 -0
  281. package/dist/http/routes/types.js +10 -0
  282. package/dist/http/routes/types.js.map +1 -0
  283. package/dist/http/server.d.ts +40 -1
  284. package/dist/http/server.d.ts.map +1 -1
  285. package/dist/http/server.js +3 -82
  286. package/dist/http/server.js.map +1 -1
  287. package/dist/index.d.ts +117 -14
  288. package/dist/index.d.ts.map +1 -1
  289. package/dist/index.js +331 -44
  290. package/dist/index.js.map +1 -1
  291. package/dist/native-messaging/messaging.d.ts +18 -0
  292. package/dist/native-messaging/messaging.d.ts.map +1 -0
  293. package/dist/native-messaging/messaging.js +94 -0
  294. package/dist/native-messaging/messaging.js.map +1 -0
  295. package/dist/native-messaging/session-manager.d.ts +105 -0
  296. package/dist/native-messaging/session-manager.d.ts.map +1 -0
  297. package/dist/native-messaging/session-manager.js +259 -0
  298. package/dist/native-messaging/session-manager.js.map +1 -0
  299. package/dist/native-messaging/types.d.ts +79 -0
  300. package/dist/native-messaging/types.d.ts.map +1 -0
  301. package/dist/native-messaging/types.js +6 -0
  302. package/dist/native-messaging/types.js.map +1 -0
  303. package/dist/registry/registry.d.ts +9 -2
  304. package/dist/registry/registry.d.ts.map +1 -1
  305. package/dist/registry/registry.js +53 -9
  306. package/dist/registry/registry.js.map +1 -1
  307. package/dist/scripts/install-host.d.ts +10 -0
  308. package/dist/scripts/install-host.d.ts.map +1 -0
  309. package/dist/scripts/install-host.js +189 -0
  310. package/dist/scripts/install-host.js.map +1 -0
  311. package/dist/sources/cdp-source.d.ts +24 -0
  312. package/dist/sources/cdp-source.d.ts.map +1 -0
  313. package/dist/sources/cdp-source.js +48 -0
  314. package/dist/sources/cdp-source.js.map +1 -0
  315. package/dist/sources/extension-source.d.ts +15 -0
  316. package/dist/sources/extension-source.d.ts.map +1 -0
  317. package/dist/sources/extension-source.js +256 -0
  318. package/dist/sources/extension-source.js.map +1 -0
  319. package/dist/sources/types.d.ts +92 -0
  320. package/dist/sources/types.d.ts.map +1 -0
  321. package/dist/sources/types.js +7 -0
  322. package/dist/sources/types.js.map +1 -0
  323. package/dist/throttle/ThrottleController.d.ts +12 -0
  324. package/dist/throttle/ThrottleController.d.ts.map +1 -0
  325. package/dist/throttle/ThrottleController.js +67 -0
  326. package/dist/throttle/ThrottleController.js.map +1 -0
  327. package/package.json +8 -2
@@ -1,19 +1,63 @@
1
- import { readRegistry, removeWatcherEntry, setWatcherEntry, writeRegistry } from '@vforsh/argus-core';
2
- /** Write watcher entry to registry. */
3
- export const announceWatcher = async (watcher) => {
1
+ import { readRegistry, removeWatcherEntry, setWatcherEntry, updateRegistry } from '@vforsh/argus-core';
2
+ /**
3
+ * Resolve a unique watcher ID. If the requested ID is taken by a live watcher,
4
+ * appends `-2`, `-3`, etc. until a free slot is found.
5
+ * Stale entries (dead process) are cleaned up automatically.
6
+ * Returns the ID that should be used.
7
+ */
8
+ export const resolveUniqueWatcherId = async (id) => {
4
9
  const { registry } = await readRegistry();
5
- const next = setWatcherEntry(registry, watcher);
6
- await writeRegistry(next);
10
+ const staleIds = [];
11
+ const isIdAvailable = (candidate) => {
12
+ const existing = registry.watchers[candidate];
13
+ if (!existing) {
14
+ return true;
15
+ }
16
+ if (existing.pid == null || !isProcessAlive(existing.pid)) {
17
+ staleIds.push(candidate);
18
+ return true;
19
+ }
20
+ return false;
21
+ };
22
+ let resolvedId = id;
23
+ if (!isIdAvailable(id)) {
24
+ let suffix = 2;
25
+ while (!isIdAvailable(`${id}-${suffix}`)) {
26
+ suffix++;
27
+ }
28
+ resolvedId = `${id}-${suffix}`;
29
+ }
30
+ if (staleIds.length > 0) {
31
+ await updateRegistry((reg) => {
32
+ let next = reg;
33
+ for (const staleId of staleIds) {
34
+ next = removeWatcherEntry(next, staleId);
35
+ }
36
+ return next;
37
+ });
38
+ }
39
+ return resolvedId;
40
+ };
41
+ const isProcessAlive = (pid) => {
42
+ try {
43
+ process.kill(pid, 0);
44
+ return true;
45
+ }
46
+ catch {
47
+ return false;
48
+ }
49
+ };
50
+ /** Write watcher entry to registry (locked read-modify-write). */
51
+ export const announceWatcher = async (watcher) => {
52
+ await updateRegistry((registry) => setWatcherEntry(registry, watcher));
7
53
  };
8
54
  /** Refresh watcher entry in registry. */
9
55
  export const updateWatcherHeartbeat = async (watcher) => {
10
56
  await announceWatcher(watcher);
11
57
  };
12
- /** Remove watcher entry from registry by id. */
58
+ /** Remove watcher entry from registry by id (locked read-modify-write). */
13
59
  export const removeWatcher = async (id) => {
14
- const { registry } = await readRegistry();
15
- const next = removeWatcherEntry(registry, id);
16
- await writeRegistry(next);
60
+ await updateRegistry((registry) => removeWatcherEntry(registry, id));
17
61
  };
18
62
  /** Periodically refresh registry entry until stopped. */
19
63
  export const startRegistryHeartbeat = (getWatcher, intervalMs = 15_000) => {
@@ -1 +1 @@
1
- {"version":3,"file":"registry.js","source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,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;QAC9B,KAAK,sBAAsB,CAAC,OAAO,CAAC,CAAA;IACrC,CAAC,EAAE,UAAU,CAAC,CAAA;IAEd,OAAO;QACN,IAAI,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC;KAChC,CAAA;AACF,CAAC,CAAA"}
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env bun
2
+ /**
3
+ * Install/uninstall Native Messaging host manifest for the Argus extension.
4
+ *
5
+ * Usage:
6
+ * node dist/scripts/install-host.js install <EXTENSION_ID>
7
+ * node dist/scripts/install-host.js uninstall
8
+ */
9
+ export {};
10
+ //# sourceMappingURL=install-host.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install-host.d.ts","sourceRoot":"","sources":["../../src/scripts/install-host.ts"],"names":[],"mappings":";AACA;;;;;;GAMG"}
@@ -0,0 +1,189 @@
1
+ #!/usr/bin/env bun
2
+ /**
3
+ * Install/uninstall Native Messaging host manifest for the Argus extension.
4
+ *
5
+ * Usage:
6
+ * node dist/scripts/install-host.js install <EXTENSION_ID>
7
+ * node dist/scripts/install-host.js uninstall
8
+ */
9
+ import fs from 'node:fs';
10
+ import path from 'node:path';
11
+ import os from 'node:os';
12
+ import { execSync } from 'node:child_process';
13
+ const __dirname = import.meta.dirname;
14
+ const HOST_NAME = 'com.vforsh.argus.bridge';
15
+ const getManifestDir = (platform) => {
16
+ switch (platform) {
17
+ case 'darwin':
18
+ return path.join(os.homedir(), 'Library/Application Support/Google/Chrome/NativeMessagingHosts');
19
+ case 'linux':
20
+ return path.join(os.homedir(), '.config/google-chrome/NativeMessagingHosts');
21
+ case 'win32':
22
+ return path.join(process.env.LOCALAPPDATA ?? os.homedir(), 'Google/Chrome/User Data/NativeMessagingHosts');
23
+ default:
24
+ throw new Error(`Unsupported platform: ${platform}`);
25
+ }
26
+ };
27
+ const getManifestPath = (platform) => {
28
+ return path.join(getManifestDir(platform), `${HOST_NAME}.json`);
29
+ };
30
+ const findArgusExecutable = () => {
31
+ // Try to find the argus CLI executable
32
+ // First, check if we're in a development environment
33
+ const devPath = path.resolve(__dirname, '../../../argus/dist/bin.js');
34
+ if (fs.existsSync(devPath)) {
35
+ return devPath;
36
+ }
37
+ // Check for globally installed argus
38
+ try {
39
+ const npmGlobalPrefix = execSync('npm config get prefix', { encoding: 'utf8' }).trim();
40
+ const globalBinPath = path.join(npmGlobalPrefix, 'bin', 'argus');
41
+ if (fs.existsSync(globalBinPath)) {
42
+ return globalBinPath;
43
+ }
44
+ }
45
+ catch {
46
+ // Ignore
47
+ }
48
+ // Check if argus is in PATH
49
+ try {
50
+ const whichPath = execSync('which argus', { encoding: 'utf8' }).trim();
51
+ if (whichPath) {
52
+ return whichPath;
53
+ }
54
+ }
55
+ catch {
56
+ // Ignore
57
+ }
58
+ throw new Error('Could not find argus executable. Please install argus globally (npm install -g @vforsh/argus) or run from the development directory.');
59
+ };
60
+ const createManifest = (extensionId, executablePath) => {
61
+ return {
62
+ name: HOST_NAME,
63
+ description: 'Argus Watcher Native Messaging Host',
64
+ path: executablePath,
65
+ type: 'stdio',
66
+ allowed_origins: [`chrome-extension://${extensionId}/`],
67
+ };
68
+ };
69
+ const findNodePath = () => {
70
+ // Get the current node executable path and resolve any symlinks
71
+ // This is important for fnm/nvm which use symlinks in temporary directories
72
+ return fs.realpathSync(process.execPath);
73
+ };
74
+ const createWrapperScript = (platform, executablePath) => {
75
+ const wrapperDir = getManifestDir(platform);
76
+ const wrapperPath = path.join(wrapperDir, 'argus-native-host.sh');
77
+ const nodePath = findNodePath();
78
+ // Create a wrapper script that launches argus in native-host mode
79
+ // Use absolute path to node since Chrome spawns without shell profile
80
+ const script = `#!/bin/bash
81
+ exec "${nodePath}" "${executablePath}" watcher native-host
82
+ `;
83
+ fs.writeFileSync(wrapperPath, script, { mode: 0o755 });
84
+ return wrapperPath;
85
+ };
86
+ const install = (extensionId) => {
87
+ const platform = os.platform();
88
+ if (!['darwin', 'linux', 'win32'].includes(platform)) {
89
+ console.error(`Unsupported platform: ${platform}`);
90
+ process.exit(1);
91
+ }
92
+ const manifestDir = getManifestDir(platform);
93
+ const manifestPath = getManifestPath(platform);
94
+ // Ensure directory exists
95
+ fs.mkdirSync(manifestDir, { recursive: true });
96
+ // Find argus executable
97
+ let executablePath;
98
+ try {
99
+ executablePath = findArgusExecutable();
100
+ }
101
+ catch (err) {
102
+ console.error(err.message);
103
+ process.exit(1);
104
+ }
105
+ // Create wrapper script (Native Messaging requires a native executable, not node)
106
+ const wrapperPath = createWrapperScript(platform, executablePath);
107
+ console.log(`Created wrapper script: ${wrapperPath}`);
108
+ // Create manifest
109
+ const manifest = createManifest(extensionId, wrapperPath);
110
+ fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2));
111
+ console.log(`Created manifest: ${manifestPath}`);
112
+ // Windows: Add registry key
113
+ if (platform === 'win32') {
114
+ const regKey = `HKCU\\Software\\Google\\Chrome\\NativeMessagingHosts\\${HOST_NAME}`;
115
+ try {
116
+ execSync(`reg add "${regKey}" /ve /t REG_SZ /d "${manifestPath}" /f`, { stdio: 'inherit' });
117
+ console.log(`Added registry key: ${regKey}`);
118
+ }
119
+ catch (err) {
120
+ console.error('Failed to add registry key:', err);
121
+ process.exit(1);
122
+ }
123
+ }
124
+ console.log('\nNative Messaging host installed successfully!');
125
+ console.log(`Host name: ${HOST_NAME}`);
126
+ console.log(`Extension ID: ${extensionId}`);
127
+ };
128
+ const uninstall = () => {
129
+ const platform = os.platform();
130
+ if (!['darwin', 'linux', 'win32'].includes(platform)) {
131
+ console.error(`Unsupported platform: ${platform}`);
132
+ process.exit(1);
133
+ }
134
+ const manifestPath = getManifestPath(platform);
135
+ const wrapperPath = path.join(getManifestDir(platform), 'argus-native-host.sh');
136
+ // Remove manifest
137
+ if (fs.existsSync(manifestPath)) {
138
+ fs.unlinkSync(manifestPath);
139
+ console.log(`Removed manifest: ${manifestPath}`);
140
+ }
141
+ else {
142
+ console.log(`Manifest not found: ${manifestPath}`);
143
+ }
144
+ // Remove wrapper script
145
+ if (fs.existsSync(wrapperPath)) {
146
+ fs.unlinkSync(wrapperPath);
147
+ console.log(`Removed wrapper script: ${wrapperPath}`);
148
+ }
149
+ // Windows: Remove registry key
150
+ if (platform === 'win32') {
151
+ const regKey = `HKCU\\Software\\Google\\Chrome\\NativeMessagingHosts\\${HOST_NAME}`;
152
+ try {
153
+ execSync(`reg delete "${regKey}" /f`, { stdio: 'inherit' });
154
+ console.log(`Removed registry key: ${regKey}`);
155
+ }
156
+ catch {
157
+ // Key might not exist
158
+ }
159
+ }
160
+ console.log('\nNative Messaging host uninstalled.');
161
+ };
162
+ const main = () => {
163
+ const args = process.argv.slice(2);
164
+ const command = args[0];
165
+ if (command === 'install') {
166
+ const extensionId = args[1];
167
+ if (!extensionId) {
168
+ console.error('Usage: install-host install <EXTENSION_ID>');
169
+ console.error('\nTo get your extension ID:');
170
+ console.error('1. Open chrome://extensions');
171
+ console.error('2. Enable Developer mode');
172
+ console.error('3. Load the argus-extension package as unpacked extension');
173
+ console.error('4. Copy the ID shown on the extension card');
174
+ process.exit(1);
175
+ }
176
+ install(extensionId);
177
+ }
178
+ else if (command === 'uninstall') {
179
+ uninstall();
180
+ }
181
+ else {
182
+ console.error('Usage:');
183
+ console.error(' install-host install <EXTENSION_ID>');
184
+ console.error(' install-host uninstall');
185
+ process.exit(1);
186
+ }
187
+ };
188
+ main();
189
+ //# sourceMappingURL=install-host.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install-host.js","sourceRoot":"","sources":["../../src/scripts/install-host.ts"],"names":[],"mappings":";AACA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,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AA4C,CAAC,CAAA;YAC3D,OAAO,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAA;YAC5C,OAAO,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAA;YAC5C,OAAO,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAA;YACzC,OAAO,CAAC,KAAK,CAAC,2DAA2D,CAAC,CAAA;YAC1E,OAAO,CAAC,KAAK,CAAC,4CAA4C,CAAC,CAAA;YAC3D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QAChB,CAAC;QACD,OAAO,CAAC,WAAW,CAAC,CAAA;IACrB,CAAC;SAAM,IAAI,OAAO,KAAK,WAAW,EAAE,CAAC;QACpC,SAAS,EAAE,CAAA;IACZ,CAAC;SAAM,CAAC;QACP,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;QACvB,OAAO,CAAC,KAAK,CAAC,uCAAuC,CAAC,CAAA;QACtD,OAAO,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAA;QACzC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAChB,CAAC;AACF,CAAC,CAAA;AAED,IAAI,EAAE,CAAA"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * CDP source for direct Chrome DevTools Protocol connection via WebSocket.
3
+ * Wraps the existing CDP watcher with the unified source interface.
4
+ */
5
+ import type { WatcherMatch, WatcherChrome } from '@vforsh/argus-core';
6
+ import { type CdpSessionController } from '../cdp/connection.js';
7
+ import type { CdpSourceHandle, CdpSourceBaseOptions } from './types.js';
8
+ /**
9
+ * Options for creating a CDP source.
10
+ */
11
+ export type CdpSourceOptions = CdpSourceBaseOptions & {
12
+ /** Chrome DevTools Protocol connection settings. */
13
+ chrome: WatcherChrome;
14
+ /** Criteria for which Chrome target(s) to attach to. */
15
+ match?: WatcherMatch;
16
+ /** Optional session controller (for sharing session handle with other components). */
17
+ sessionHandle?: CdpSessionController;
18
+ };
19
+ /**
20
+ * Create a CDP source that connects to Chrome via WebSocket.
21
+ * Returns a handle that can be used to control the source and access CDP session.
22
+ */
23
+ export declare const createCdpSource: (options: CdpSourceOptions) => CdpSourceHandle;
24
+ //# sourceMappingURL=cdp-source.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cdp-source.d.ts","sourceRoot":"","sources":["../../src/sources/cdp-source.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAErE,OAAO,EAA0B,KAAK,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAExF,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAEvE;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,GAAG;IACrD,oDAAoD;IACpD,MAAM,EAAE,aAAa,CAAA;IACrB,wDAAwD;IACxD,KAAK,CAAC,EAAE,YAAY,CAAA;IACpB,sFAAsF;IACtF,aAAa,CAAC,EAAE,oBAAoB,CAAA;CACpC,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,SAAS,gBAAgB,KAAG,eA0C3D,CAAA"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * CDP source for direct Chrome DevTools Protocol connection via WebSocket.
3
+ * Wraps the existing CDP watcher with the unified source interface.
4
+ */
5
+ import { startCdpWatcher } from '../cdp/watcher.js';
6
+ import { createCdpSessionHandle } from '../cdp/connection.js';
7
+ /**
8
+ * Create a CDP source that connects to Chrome via WebSocket.
9
+ * Returns a handle that can be used to control the source and access CDP session.
10
+ */
11
+ export const createCdpSource = (options) => {
12
+ const { events, ignoreMatcher, stripUrlPrefixes, chrome, match, sessionHandle } = options;
13
+ // Create session handle if not provided
14
+ const controller = sessionHandle ?? createCdpSessionHandle();
15
+ // Convert ignoreMatcher function to IgnoreMatcher object if needed
16
+ const ignoreMatcherObj = ignoreMatcher ? { matches: ignoreMatcher } : null;
17
+ // Map source events to watcher events
18
+ const watcherOptions = {
19
+ chrome,
20
+ match,
21
+ sessionHandle: controller,
22
+ ignoreMatcher: ignoreMatcherObj,
23
+ stripUrlPrefixes,
24
+ onLog: events.onLog,
25
+ onStatus: events.onStatus,
26
+ onPageNavigation: events.onPageNavigation,
27
+ onPageLoad: events.onPageLoad,
28
+ onPageIntl: events.onPageIntl,
29
+ onAttach: events.onAttach
30
+ ? (session, target) => events.onAttach(session, {
31
+ id: target.id,
32
+ title: target.title,
33
+ url: target.url,
34
+ type: target.type,
35
+ parentId: target.parentId,
36
+ })
37
+ : undefined,
38
+ onDetach: events.onDetach,
39
+ };
40
+ const watcher = startCdpWatcher(watcherOptions);
41
+ return {
42
+ session: watcher.session,
43
+ stop: watcher.stop,
44
+ // CDP mode doesn't support listTargets/attachTarget/detachTarget
45
+ // (auto-attaches based on match criteria)
46
+ };
47
+ };
48
+ //# sourceMappingURL=cdp-source.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cdp-source.js","sourceRoot":"","sources":["../../src/sources/cdp-source.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,eAAe,EAA0B,MAAM,mBAAmB,CAAA;AAC3E,OAAO,EAAE,sBAAsB,EAA6B,MAAM,sBAAsB,CAAA;AAgBxF;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAAyB,EAAmB,EAAE;IAC7E,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,OAAO,CAAA;IAEzF,wCAAwC;IACxC,MAAM,UAAU,GAAG,aAAa,IAAI,sBAAsB,EAAE,CAAA;IAE5D,mEAAmE;IACnE,MAAM,gBAAgB,GAAyB,aAAa,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;IAEhG,sCAAsC;IACtC,MAAM,cAAc,GAAsB;QACzC,MAAM;QACN,KAAK;QACL,aAAa,EAAE,UAAU;QACzB,aAAa,EAAE,gBAAgB;QAC/B,gBAAgB;QAChB,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;QACzC,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACxB,CAAC,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,CACpB,MAAM,CAAC,QAAS,CAAC,OAAO,EAAE;gBACzB,EAAE,EAAE,MAAM,CAAC,EAAE;gBACb,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,GAAG,EAAE,MAAM,CAAC,GAAG;gBACf,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,QAAQ,EAAE,MAAM,CAAC,QAAQ;aACzB,CAAC;YACJ,CAAC,CAAC,SAAS;QACZ,QAAQ,EAAE,MAAM,CAAC,QAAQ;KACzB,CAAA;IAED,MAAM,OAAO,GAAG,eAAe,CAAC,cAAc,CAAC,CAAA;IAE/C,OAAO;QACN,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,iEAAiE;QACjE,0CAA0C;KAC1C,CAAA;AACF,CAAC,CAAA"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Extension source for CDP access via Chrome extension Native Messaging.
3
+ * Wraps SessionManager and provides a unified source interface.
4
+ */
5
+ import type { CdpSourceHandle, CdpSourceBaseOptions } from './types.js';
6
+ /**
7
+ * Options for creating an extension source.
8
+ */
9
+ export type ExtensionSourceOptions = CdpSourceBaseOptions;
10
+ /**
11
+ * Create an extension source that connects to Chrome via Native Messaging.
12
+ * Returns a handle that can be used to control the source and access CDP session.
13
+ */
14
+ export declare const createExtensionSource: (options: ExtensionSourceOptions) => CdpSourceHandle;
15
+ //# sourceMappingURL=extension-source.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extension-source.d.ts","sourceRoot":"","sources":["../../src/sources/extension-source.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,KAAK,EAAE,eAAe,EAAmB,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAGxF;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,oBAAoB,CAAA;AAEzD;;;GAGG;AACH,eAAO,MAAM,qBAAqB,GAAI,SAAS,sBAAsB,KAAG,eAyIvE,CAAA"}
@@ -0,0 +1,256 @@
1
+ /**
2
+ * Extension source for CDP access via Chrome extension Native Messaging.
3
+ * Wraps SessionManager and provides a unified source interface.
4
+ */
5
+ import { previewStringify } from '@vforsh/argus-core';
6
+ import { createNativeMessaging } from '../native-messaging/messaging.js';
7
+ import { SessionManager } from '../native-messaging/session-manager.js';
8
+ /**
9
+ * Create an extension source that connects to Chrome via Native Messaging.
10
+ * Returns a handle that can be used to control the source and access CDP session.
11
+ */
12
+ export const createExtensionSource = (options) => {
13
+ const { events, ignoreMatcher, stripUrlPrefixes } = options;
14
+ const messaging = createNativeMessaging();
15
+ let currentSession = null;
16
+ let stopping = false;
17
+ // Create session manager with event handlers
18
+ const sessionManager = new SessionManager(messaging, {
19
+ onAttach: (session) => {
20
+ console.error(`[ExtensionSource] Tab attached: ${session.tabId} - ${session.url}`);
21
+ currentSession = session;
22
+ sessionManager.enableDomain(session.tabId, 'Page');
23
+ // Subscribe to console events
24
+ session.handle.onEvent('Runtime.consoleAPICalled', (params) => {
25
+ const logEvent = toConsoleEvent(params, session, { ignoreMatcher, stripUrlPrefixes });
26
+ events.onLog(logEvent);
27
+ });
28
+ // Subscribe to exception events
29
+ session.handle.onEvent('Runtime.exceptionThrown', (params) => {
30
+ const logEvent = toExceptionEvent(params, session, { ignoreMatcher, stripUrlPrefixes });
31
+ events.onLog(logEvent);
32
+ });
33
+ // Notify status change
34
+ const target = {
35
+ id: String(session.tabId),
36
+ title: session.title,
37
+ url: session.url,
38
+ type: 'page',
39
+ faviconUrl: session.faviconUrl,
40
+ attached: true,
41
+ };
42
+ events.onStatus({
43
+ attached: true,
44
+ target: {
45
+ title: session.title,
46
+ url: session.url,
47
+ type: 'page',
48
+ parentId: null,
49
+ },
50
+ reason: null,
51
+ });
52
+ void events.onAttach?.(session.handle, target);
53
+ },
54
+ onDetach: (tabId, reason) => {
55
+ console.error(`[ExtensionSource] Tab detached: ${tabId} - ${reason}`);
56
+ if (currentSession?.tabId === tabId) {
57
+ currentSession = null;
58
+ }
59
+ events.onStatus({
60
+ attached: false,
61
+ target: null,
62
+ reason,
63
+ });
64
+ events.onDetach?.(reason);
65
+ },
66
+ onTabsUpdated: () => {
67
+ // Tabs list updated - no action needed
68
+ },
69
+ });
70
+ // Create a proxy session handle that delegates to the current session
71
+ const proxySession = {
72
+ isAttached: () => currentSession?.handle.isAttached() ?? false,
73
+ sendAndWait: async (method, params, options) => {
74
+ const session = currentSession;
75
+ if (!session) {
76
+ const error = new Error('No tab attached via extension');
77
+ error.code = 'cdp_not_attached';
78
+ throw error;
79
+ }
80
+ return session.handle.sendAndWait(method, params, options);
81
+ },
82
+ onEvent: (method, handler) => {
83
+ // For proxy session, we need to track all handlers and replay them
84
+ // when a new session is attached. For now, just use the current session.
85
+ if (!currentSession) {
86
+ // Return a no-op unsubscribe function
87
+ return () => { };
88
+ }
89
+ return currentSession.handle.onEvent(method, handler);
90
+ },
91
+ };
92
+ // Start Native Messaging
93
+ messaging.start();
94
+ messaging.onDisconnect(() => {
95
+ console.error('[ExtensionSource] Extension disconnected');
96
+ if (!stopping) {
97
+ events.onStatus({
98
+ attached: false,
99
+ target: null,
100
+ reason: 'extension_disconnected',
101
+ });
102
+ events.onDetach?.('extension_disconnected');
103
+ }
104
+ });
105
+ const stop = async () => {
106
+ stopping = true;
107
+ messaging.stop();
108
+ };
109
+ const listTargets = async () => {
110
+ const tabs = await sessionManager.listTabs();
111
+ return tabs.map(tabToTarget);
112
+ };
113
+ const attachTarget = (targetId) => {
114
+ sessionManager.attachTab(targetId);
115
+ };
116
+ const detachTarget = (targetId) => {
117
+ sessionManager.detachTab(targetId);
118
+ };
119
+ return {
120
+ session: proxySession,
121
+ stop,
122
+ listTargets,
123
+ attachTarget,
124
+ detachTarget,
125
+ };
126
+ };
127
+ /**
128
+ * Convert TabInfo to CdpSourceTarget.
129
+ */
130
+ const tabToTarget = (tab) => ({
131
+ id: String(tab.tabId),
132
+ title: tab.title,
133
+ url: tab.url,
134
+ type: 'page',
135
+ faviconUrl: tab.faviconUrl,
136
+ attached: tab.attached,
137
+ });
138
+ /**
139
+ * Convert Runtime.consoleAPICalled event to LogEvent.
140
+ */
141
+ const toConsoleEvent = (params, session, config) => {
142
+ const record = params;
143
+ const args = record.args?.map((a) => a.value) ?? [];
144
+ const text = formatArgs(record.args ?? []);
145
+ const frame = selectBestFrame(record.stackTrace?.callFrames, config.ignoreMatcher);
146
+ return {
147
+ ts: record.timestamp ?? Date.now(),
148
+ level: normalizeLevel(record.type ?? 'log'),
149
+ text,
150
+ args,
151
+ source: 'console',
152
+ file: applyStripPrefixes(frame?.url ?? null, config.stripUrlPrefixes),
153
+ line: frame?.lineNumber != null ? frame.lineNumber + 1 : null,
154
+ column: frame?.columnNumber != null ? frame.columnNumber + 1 : null,
155
+ pageUrl: session.url,
156
+ pageTitle: session.title,
157
+ };
158
+ };
159
+ /**
160
+ * Convert Runtime.exceptionThrown event to LogEvent.
161
+ */
162
+ const toExceptionEvent = (params, session, config) => {
163
+ const record = params;
164
+ const details = record.exceptionDetails;
165
+ const text = details?.exception?.description ?? details?.text ?? 'Exception';
166
+ const args = details?.exception ? [details.exception.value ?? details.exception.description] : [];
167
+ const frame = selectBestFrame(details?.stackTrace?.callFrames, config.ignoreMatcher);
168
+ return {
169
+ ts: record.timestamp ?? Date.now(),
170
+ level: 'exception',
171
+ text,
172
+ args,
173
+ source: 'exception',
174
+ file: applyStripPrefixes(frame?.url ?? null, config.stripUrlPrefixes),
175
+ line: frame?.lineNumber != null ? frame.lineNumber + 1 : null,
176
+ column: frame?.columnNumber != null ? frame.columnNumber + 1 : null,
177
+ pageUrl: session.url,
178
+ pageTitle: session.title,
179
+ };
180
+ };
181
+ /**
182
+ * Format console args for display.
183
+ */
184
+ const formatArgs = (args) => {
185
+ if (args.length === 0) {
186
+ return '';
187
+ }
188
+ return args
189
+ .map((arg) => {
190
+ if (arg.value !== undefined) {
191
+ return typeof arg.value === 'string' ? arg.value : previewStringify(arg.value);
192
+ }
193
+ return arg.description ?? `[${arg.type}]`;
194
+ })
195
+ .join(' ');
196
+ };
197
+ /**
198
+ * Normalize console log type to LogLevel.
199
+ */
200
+ const normalizeLevel = (type) => {
201
+ switch (type) {
202
+ case 'log':
203
+ case 'info':
204
+ case 'debug':
205
+ case 'dir':
206
+ case 'dirxml':
207
+ case 'table':
208
+ case 'trace':
209
+ case 'count':
210
+ case 'timeEnd':
211
+ case 'timeLog':
212
+ return type === 'debug' ? 'debug' : type === 'info' ? 'info' : 'log';
213
+ case 'warn':
214
+ case 'warning':
215
+ return 'warning';
216
+ case 'error':
217
+ case 'assert':
218
+ case 'exception':
219
+ return type === 'exception' ? 'exception' : 'error';
220
+ default:
221
+ return 'log';
222
+ }
223
+ };
224
+ /**
225
+ * Select the best frame from the stack trace (first non-ignored frame).
226
+ */
227
+ const selectBestFrame = (frames, ignoreMatcher) => {
228
+ if (!frames || frames.length === 0) {
229
+ return null;
230
+ }
231
+ if (!ignoreMatcher) {
232
+ return frames[0] ?? null;
233
+ }
234
+ for (const frame of frames) {
235
+ if (frame.url && !ignoreMatcher(frame.url)) {
236
+ return frame;
237
+ }
238
+ }
239
+ // Fall back to first frame if all are ignored
240
+ return frames[0] ?? null;
241
+ };
242
+ /**
243
+ * Apply strip prefixes to a file URL.
244
+ */
245
+ const applyStripPrefixes = (file, prefixes) => {
246
+ if (!file || !prefixes || prefixes.length === 0) {
247
+ return file;
248
+ }
249
+ for (const prefix of prefixes) {
250
+ if (file.startsWith(prefix)) {
251
+ return file.slice(prefix.length);
252
+ }
253
+ }
254
+ return file;
255
+ };
256
+ //# sourceMappingURL=extension-source.js.map