@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.
- package/README.md +67 -14
- package/dist/.tsbuildinfo +1 -1
- package/dist/artifacts.d.ts +13 -0
- package/dist/artifacts.d.ts.map +1 -0
- package/dist/artifacts.js +27 -0
- package/dist/artifacts.js.map +1 -0
- package/dist/buffer/LogBuffer.d.ts +8 -3
- package/dist/buffer/LogBuffer.d.ts.map +1 -1
- package/dist/buffer/LogBuffer.js +9 -1
- package/dist/buffer/LogBuffer.js.map +1 -1
- package/dist/buffer/NetBuffer.d.ts +29 -0
- package/dist/buffer/NetBuffer.d.ts.map +1 -0
- package/dist/buffer/NetBuffer.js +85 -0
- package/dist/buffer/NetBuffer.js.map +1 -0
- package/dist/cdp/accessibility.d.ts +18 -0
- package/dist/cdp/accessibility.d.ts.map +1 -0
- package/dist/cdp/accessibility.js +300 -0
- package/dist/cdp/accessibility.js.map +1 -0
- package/dist/cdp/connection.d.ts +39 -0
- package/dist/cdp/connection.d.ts.map +1 -0
- package/dist/cdp/connection.js +131 -0
- package/dist/cdp/connection.js.map +1 -0
- package/dist/cdp/dom/fill.d.ts +22 -0
- package/dist/cdp/dom/fill.d.ts.map +1 -0
- package/dist/cdp/dom/fill.js +59 -0
- package/dist/cdp/dom/fill.js.map +1 -0
- package/dist/cdp/dom/info.d.ts +14 -0
- package/dist/cdp/dom/info.d.ts.map +1 -0
- package/dist/cdp/dom/info.js +52 -0
- package/dist/cdp/dom/info.js.map +1 -0
- package/dist/cdp/dom/insert.d.ts +19 -0
- package/dist/cdp/dom/insert.d.ts.map +1 -0
- package/dist/cdp/dom/insert.js +30 -0
- package/dist/cdp/dom/insert.js.map +1 -0
- package/dist/cdp/dom/modify.d.ts +50 -0
- package/dist/cdp/dom/modify.d.ts.map +1 -0
- package/dist/cdp/dom/modify.js +100 -0
- package/dist/cdp/dom/modify.js.map +1 -0
- package/dist/cdp/dom/remove.d.ts +17 -0
- package/dist/cdp/dom/remove.d.ts.map +1 -0
- package/dist/cdp/dom/remove.js +27 -0
- package/dist/cdp/dom/remove.js.map +1 -0
- package/dist/cdp/dom/selector.d.ts +19 -0
- package/dist/cdp/dom/selector.d.ts.map +1 -0
- package/dist/cdp/dom/selector.js +86 -0
- package/dist/cdp/dom/selector.js.map +1 -0
- package/dist/cdp/dom/setFile.d.ts +21 -0
- package/dist/cdp/dom/setFile.d.ts.map +1 -0
- package/dist/cdp/dom/setFile.js +25 -0
- package/dist/cdp/dom/setFile.js.map +1 -0
- package/dist/cdp/dom/submit.d.ts +15 -0
- package/dist/cdp/dom/submit.d.ts.map +1 -0
- package/dist/cdp/dom/submit.js +130 -0
- package/dist/cdp/dom/submit.js.map +1 -0
- package/dist/cdp/dom/tree.d.ts +16 -0
- package/dist/cdp/dom/tree.d.ts.map +1 -0
- package/dist/cdp/dom/tree.js +100 -0
- package/dist/cdp/dom/tree.js.map +1 -0
- package/dist/cdp/dom/types.d.ts +15 -0
- package/dist/cdp/dom/types.d.ts.map +1 -0
- package/dist/cdp/dom/types.js +2 -0
- package/dist/cdp/dom/types.js.map +1 -0
- package/dist/cdp/dom.d.ts +15 -0
- package/dist/cdp/dom.d.ts.map +1 -0
- package/dist/cdp/dom.js +9 -0
- package/dist/cdp/dom.js.map +1 -0
- package/dist/cdp/editor.d.ts +23 -0
- package/dist/cdp/editor.d.ts.map +1 -0
- package/dist/cdp/editor.js +266 -0
- package/dist/cdp/editor.js.map +1 -0
- package/dist/cdp/emulation.d.ts +16 -0
- package/dist/cdp/emulation.d.ts.map +1 -0
- package/dist/cdp/emulation.js +40 -0
- package/dist/cdp/emulation.js.map +1 -0
- package/dist/cdp/eval.d.ts +11 -0
- package/dist/cdp/eval.d.ts.map +1 -0
- package/dist/cdp/eval.js +79 -0
- package/dist/cdp/eval.js.map +1 -0
- package/dist/cdp/keyboard.d.ts +38 -0
- package/dist/cdp/keyboard.d.ts.map +1 -0
- package/dist/cdp/keyboard.js +148 -0
- package/dist/cdp/keyboard.js.map +1 -0
- package/dist/cdp/mouse.d.ts +49 -0
- package/dist/cdp/mouse.d.ts.map +1 -0
- package/dist/cdp/mouse.js +203 -0
- package/dist/cdp/mouse.js.map +1 -0
- package/dist/cdp/networkCapture.d.ts +11 -0
- package/dist/cdp/networkCapture.d.ts.map +1 -0
- package/dist/cdp/networkCapture.js +99 -0
- package/dist/cdp/networkCapture.js.map +1 -0
- package/dist/cdp/pageIndicator.d.ts +41 -0
- package/dist/cdp/pageIndicator.d.ts.map +1 -0
- package/dist/cdp/pageIndicator.js +395 -0
- package/dist/cdp/pageIndicator.js.map +1 -0
- package/dist/cdp/redaction.d.ts +3 -0
- package/dist/cdp/redaction.d.ts.map +1 -0
- package/dist/cdp/redaction.js +35 -0
- package/dist/cdp/redaction.js.map +1 -0
- package/dist/cdp/remoteObject.d.ts +6 -0
- package/dist/cdp/remoteObject.d.ts.map +1 -0
- package/dist/cdp/remoteObject.js +94 -0
- package/dist/cdp/remoteObject.js.map +1 -0
- package/dist/cdp/screenshot.d.ts +10 -0
- package/dist/cdp/screenshot.d.ts.map +1 -0
- package/dist/cdp/screenshot.js +83 -0
- package/dist/cdp/screenshot.js.map +1 -0
- package/dist/cdp/storageLocal.d.ts +8 -0
- package/dist/cdp/storageLocal.d.ts.map +1 -0
- package/dist/cdp/storageLocal.js +70 -0
- package/dist/cdp/storageLocal.js.map +1 -0
- package/dist/cdp/text-filter.d.ts +6 -0
- package/dist/cdp/text-filter.d.ts.map +1 -0
- package/dist/cdp/text-filter.js +36 -0
- package/dist/cdp/text-filter.js.map +1 -0
- package/dist/cdp/throttle.d.ts +6 -0
- package/dist/cdp/throttle.d.ts.map +1 -0
- package/dist/cdp/throttle.js +9 -0
- package/dist/cdp/throttle.js.map +1 -0
- package/dist/cdp/tracing.d.ts +15 -0
- package/dist/cdp/tracing.d.ts.map +1 -0
- package/dist/cdp/tracing.js +159 -0
- package/dist/cdp/tracing.js.map +1 -0
- package/dist/cdp/watcher.d.ts +17 -2
- package/dist/cdp/watcher.d.ts.map +1 -1
- package/dist/cdp/watcher.js +124 -175
- package/dist/cdp/watcher.js.map +1 -1
- package/dist/emulation/EmulationController.d.ts +12 -0
- package/dist/emulation/EmulationController.d.ts.map +1 -0
- package/dist/emulation/EmulationController.js +83 -0
- package/dist/emulation/EmulationController.js.map +1 -0
- package/dist/events.d.ts +86 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +2 -0
- package/dist/events.js.map +1 -0
- package/dist/fileLogs/WatcherFileLogger.d.ts +5 -2
- package/dist/fileLogs/WatcherFileLogger.d.ts.map +1 -1
- package/dist/fileLogs/WatcherFileLogger.js +30 -12
- package/dist/fileLogs/WatcherFileLogger.js.map +1 -1
- package/dist/http/httpUtils.d.ts +25 -0
- package/dist/http/httpUtils.d.ts.map +1 -0
- package/dist/http/httpUtils.js +170 -0
- package/dist/http/httpUtils.js.map +1 -0
- package/dist/http/router.d.ts +5 -0
- package/dist/http/router.d.ts.map +1 -0
- package/dist/http/router.js +85 -0
- package/dist/http/router.js.map +1 -0
- package/dist/http/routes/getEmulation.d.ts +3 -0
- package/dist/http/routes/getEmulation.d.ts.map +1 -0
- package/dist/http/routes/getEmulation.js +8 -0
- package/dist/http/routes/getEmulation.js.map +1 -0
- package/dist/http/routes/getLogs.d.ts +3 -0
- package/dist/http/routes/getLogs.d.ts.map +1 -0
- package/dist/http/routes/getLogs.js +28 -0
- package/dist/http/routes/getLogs.js.map +1 -0
- package/dist/http/routes/getNet.d.ts +3 -0
- package/dist/http/routes/getNet.d.ts.map +1 -0
- package/dist/http/routes/getNet.js +17 -0
- package/dist/http/routes/getNet.js.map +1 -0
- package/dist/http/routes/getNetTail.d.ts +3 -0
- package/dist/http/routes/getNetTail.d.ts.map +1 -0
- package/dist/http/routes/getNetTail.js +18 -0
- package/dist/http/routes/getNetTail.js.map +1 -0
- package/dist/http/routes/getStatus.d.ts +3 -0
- package/dist/http/routes/getStatus.d.ts.map +1 -0
- package/dist/http/routes/getStatus.js +21 -0
- package/dist/http/routes/getStatus.js.map +1 -0
- package/dist/http/routes/getTail.d.ts +3 -0
- package/dist/http/routes/getTail.d.ts.map +1 -0
- package/dist/http/routes/getTail.js +28 -0
- package/dist/http/routes/getTail.js.map +1 -0
- package/dist/http/routes/getTargets.d.ts +3 -0
- package/dist/http/routes/getTargets.d.ts.map +1 -0
- package/dist/http/routes/getTargets.js +16 -0
- package/dist/http/routes/getTargets.js.map +1 -0
- package/dist/http/routes/getThrottle.d.ts +3 -0
- package/dist/http/routes/getThrottle.d.ts.map +1 -0
- package/dist/http/routes/getThrottle.js +8 -0
- package/dist/http/routes/getThrottle.js.map +1 -0
- package/dist/http/routes/postAttach.d.ts +3 -0
- package/dist/http/routes/postAttach.d.ts.map +1 -0
- package/dist/http/routes/postAttach.js +24 -0
- package/dist/http/routes/postAttach.js.map +1 -0
- package/dist/http/routes/postCodeEdit.d.ts +3 -0
- package/dist/http/routes/postCodeEdit.d.ts.map +1 -0
- package/dist/http/routes/postCodeEdit.js +32 -0
- package/dist/http/routes/postCodeEdit.js.map +1 -0
- package/dist/http/routes/postCodeGrep.d.ts +3 -0
- package/dist/http/routes/postCodeGrep.d.ts.map +1 -0
- package/dist/http/routes/postCodeGrep.js +26 -0
- package/dist/http/routes/postCodeGrep.js.map +1 -0
- package/dist/http/routes/postCodeList.d.ts +3 -0
- package/dist/http/routes/postCodeList.d.ts.map +1 -0
- package/dist/http/routes/postCodeList.js +20 -0
- package/dist/http/routes/postCodeList.js.map +1 -0
- package/dist/http/routes/postCodeRead.d.ts +3 -0
- package/dist/http/routes/postCodeRead.d.ts.map +1 -0
- package/dist/http/routes/postCodeRead.js +30 -0
- package/dist/http/routes/postCodeRead.js.map +1 -0
- package/dist/http/routes/postDetach.d.ts +3 -0
- package/dist/http/routes/postDetach.d.ts.map +1 -0
- package/dist/http/routes/postDetach.js +24 -0
- package/dist/http/routes/postDetach.js.map +1 -0
- package/dist/http/routes/postDomAdd.d.ts +7 -0
- package/dist/http/routes/postDomAdd.d.ts.map +1 -0
- package/dist/http/routes/postDomAdd.js +97 -0
- package/dist/http/routes/postDomAdd.js.map +1 -0
- package/dist/http/routes/postDomClick.d.ts +3 -0
- package/dist/http/routes/postDomClick.d.ts.map +1 -0
- package/dist/http/routes/postDomClick.js +85 -0
- package/dist/http/routes/postDomClick.js.map +1 -0
- package/dist/http/routes/postDomFill.d.ts +3 -0
- package/dist/http/routes/postDomFill.d.ts.map +1 -0
- package/dist/http/routes/postDomFill.js +58 -0
- package/dist/http/routes/postDomFill.js.map +1 -0
- package/dist/http/routes/postDomFocus.d.ts +3 -0
- package/dist/http/routes/postDomFocus.d.ts.map +1 -0
- package/dist/http/routes/postDomFocus.js +40 -0
- package/dist/http/routes/postDomFocus.js.map +1 -0
- package/dist/http/routes/postDomHover.d.ts +3 -0
- package/dist/http/routes/postDomHover.d.ts.map +1 -0
- package/dist/http/routes/postDomHover.js +40 -0
- package/dist/http/routes/postDomHover.js.map +1 -0
- package/dist/http/routes/postDomInfo.d.ts +3 -0
- package/dist/http/routes/postDomInfo.d.ts.map +1 -0
- package/dist/http/routes/postDomInfo.js +40 -0
- package/dist/http/routes/postDomInfo.js.map +1 -0
- package/dist/http/routes/postDomKeydown.d.ts +3 -0
- package/dist/http/routes/postDomKeydown.d.ts.map +1 -0
- package/dist/http/routes/postDomKeydown.js +36 -0
- package/dist/http/routes/postDomKeydown.js.map +1 -0
- package/dist/http/routes/postDomModify.d.ts +3 -0
- package/dist/http/routes/postDomModify.d.ts.map +1 -0
- package/dist/http/routes/postDomModify.js +45 -0
- package/dist/http/routes/postDomModify.js.map +1 -0
- package/dist/http/routes/postDomRemove.d.ts +3 -0
- package/dist/http/routes/postDomRemove.d.ts.map +1 -0
- package/dist/http/routes/postDomRemove.js +39 -0
- package/dist/http/routes/postDomRemove.js.map +1 -0
- package/dist/http/routes/postDomScroll.d.ts +3 -0
- package/dist/http/routes/postDomScroll.d.ts.map +1 -0
- package/dist/http/routes/postDomScroll.js +75 -0
- package/dist/http/routes/postDomScroll.js.map +1 -0
- package/dist/http/routes/postDomScrollTo.d.ts +3 -0
- package/dist/http/routes/postDomScrollTo.d.ts.map +1 -0
- package/dist/http/routes/postDomScrollTo.js +69 -0
- package/dist/http/routes/postDomScrollTo.js.map +1 -0
- package/dist/http/routes/postDomSetFile.d.ts +3 -0
- package/dist/http/routes/postDomSetFile.d.ts.map +1 -0
- package/dist/http/routes/postDomSetFile.js +58 -0
- package/dist/http/routes/postDomSetFile.js.map +1 -0
- package/dist/http/routes/postDomSubmit.d.ts +3 -0
- package/dist/http/routes/postDomSubmit.d.ts.map +1 -0
- package/dist/http/routes/postDomSubmit.js +49 -0
- package/dist/http/routes/postDomSubmit.js.map +1 -0
- package/dist/http/routes/postDomTree.d.ts +3 -0
- package/dist/http/routes/postDomTree.d.ts.map +1 -0
- package/dist/http/routes/postDomTree.js +41 -0
- package/dist/http/routes/postDomTree.js.map +1 -0
- package/dist/http/routes/postEmulation.d.ts +3 -0
- package/dist/http/routes/postEmulation.d.ts.map +1 -0
- package/dist/http/routes/postEmulation.js +70 -0
- package/dist/http/routes/postEmulation.js.map +1 -0
- package/dist/http/routes/postEval.d.ts +3 -0
- package/dist/http/routes/postEval.d.ts.map +1 -0
- package/dist/http/routes/postEval.js +27 -0
- package/dist/http/routes/postEval.js.map +1 -0
- package/dist/http/routes/postReload.d.ts +3 -0
- package/dist/http/routes/postReload.d.ts.map +1 -0
- package/dist/http/routes/postReload.js +20 -0
- package/dist/http/routes/postReload.js.map +1 -0
- package/dist/http/routes/postScreenshot.d.ts +3 -0
- package/dist/http/routes/postScreenshot.d.ts.map +1 -0
- package/dist/http/routes/postScreenshot.js +17 -0
- package/dist/http/routes/postScreenshot.js.map +1 -0
- package/dist/http/routes/postShutdown.d.ts +3 -0
- package/dist/http/routes/postShutdown.d.ts.map +1 -0
- package/dist/http/routes/postShutdown.js +13 -0
- package/dist/http/routes/postShutdown.js.map +1 -0
- package/dist/http/routes/postSnapshot.d.ts +3 -0
- package/dist/http/routes/postSnapshot.d.ts.map +1 -0
- package/dist/http/routes/postSnapshot.js +28 -0
- package/dist/http/routes/postSnapshot.js.map +1 -0
- package/dist/http/routes/postStorageLocal.d.ts +3 -0
- package/dist/http/routes/postStorageLocal.d.ts.map +1 -0
- package/dist/http/routes/postStorageLocal.js +31 -0
- package/dist/http/routes/postStorageLocal.js.map +1 -0
- package/dist/http/routes/postThrottle.d.ts +3 -0
- package/dist/http/routes/postThrottle.d.ts.map +1 -0
- package/dist/http/routes/postThrottle.js +38 -0
- package/dist/http/routes/postThrottle.js.map +1 -0
- package/dist/http/routes/postTraceStart.d.ts +3 -0
- package/dist/http/routes/postTraceStart.d.ts.map +1 -0
- package/dist/http/routes/postTraceStart.js +17 -0
- package/dist/http/routes/postTraceStart.js.map +1 -0
- package/dist/http/routes/postTraceStop.d.ts +3 -0
- package/dist/http/routes/postTraceStop.d.ts.map +1 -0
- package/dist/http/routes/postTraceStop.js +17 -0
- package/dist/http/routes/postTraceStop.js.map +1 -0
- package/dist/http/routes/types.d.ts +9 -0
- package/dist/http/routes/types.d.ts.map +1 -0
- package/dist/http/routes/types.js +10 -0
- package/dist/http/routes/types.js.map +1 -0
- package/dist/http/server.d.ts +42 -1
- package/dist/http/server.d.ts.map +1 -1
- package/dist/http/server.js +3 -82
- package/dist/http/server.js.map +1 -1
- package/dist/index.d.ts +117 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +349 -44
- package/dist/index.js.map +1 -1
- package/dist/native-messaging/messaging.d.ts +18 -0
- package/dist/native-messaging/messaging.d.ts.map +1 -0
- package/dist/native-messaging/messaging.js +94 -0
- package/dist/native-messaging/messaging.js.map +1 -0
- package/dist/native-messaging/session-manager.d.ts +108 -0
- package/dist/native-messaging/session-manager.d.ts.map +1 -0
- package/dist/native-messaging/session-manager.js +267 -0
- package/dist/native-messaging/session-manager.js.map +1 -0
- package/dist/native-messaging/types.d.ts +112 -0
- package/dist/native-messaging/types.d.ts.map +1 -0
- package/dist/native-messaging/types.js +6 -0
- package/dist/native-messaging/types.js.map +1 -0
- package/dist/registry/registry.d.ts +9 -2
- package/dist/registry/registry.d.ts.map +1 -1
- package/dist/registry/registry.js +53 -9
- package/dist/registry/registry.js.map +1 -1
- package/dist/scripts/install-host.d.ts +10 -0
- package/dist/scripts/install-host.d.ts.map +1 -0
- package/dist/scripts/install-host.js +189 -0
- package/dist/scripts/install-host.js.map +1 -0
- package/dist/sources/cdp-source.d.ts +24 -0
- package/dist/sources/cdp-source.d.ts.map +1 -0
- package/dist/sources/cdp-source.js +49 -0
- package/dist/sources/cdp-source.js.map +1 -0
- package/dist/sources/extension-frame-state.d.ts +64 -0
- package/dist/sources/extension-frame-state.d.ts.map +1 -0
- package/dist/sources/extension-frame-state.js +117 -0
- package/dist/sources/extension-frame-state.js.map +1 -0
- package/dist/sources/extension-log-events.d.ts +15 -0
- package/dist/sources/extension-log-events.d.ts.map +1 -0
- package/dist/sources/extension-log-events.js +101 -0
- package/dist/sources/extension-log-events.js.map +1 -0
- package/dist/sources/extension-source.d.ts +15 -0
- package/dist/sources/extension-source.d.ts.map +1 -0
- package/dist/sources/extension-source.js +487 -0
- package/dist/sources/extension-source.js.map +1 -0
- package/dist/sources/types.d.ts +109 -0
- package/dist/sources/types.d.ts.map +1 -0
- package/dist/sources/types.js +7 -0
- package/dist/sources/types.js.map +1 -0
- package/dist/throttle/ThrottleController.d.ts +12 -0
- package/dist/throttle/ThrottleController.d.ts.map +1 -0
- package/dist/throttle/ThrottleController.js +67 -0
- package/dist/throttle/ThrottleController.js.map +1 -0
- package/package.json +3 -2
|
@@ -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,CAAC,OAAQ,CAAA;AAEtC,MAAM,SAAS,GAAG,yBAAyB,CAAA;AAI3C,MAAM,cAAc,GAAG,CAAC,QAAkB,EAAU,EAAE;IACrD,QAAQ,QAAQ,EAAE,CAAC;QAClB,KAAK,QAAQ;YACZ,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,gEAAgE,CAAC,CAAA;QACjG,KAAK,OAAO;YACX,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,4CAA4C,CAAC,CAAA;QAC7E,KAAK,OAAO;YACX,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,EAAE,CAAC,OAAO,EAAE,EAAE,8CAA8C,CAAC,CAAA;QAC3G;YACC,MAAM,IAAI,KAAK,CAAC,yBAAyB,QAAQ,EAAE,CAAC,CAAA;IACtD,CAAC;AACF,CAAC,CAAA;AAED,MAAM,eAAe,GAAG,CAAC,QAAkB,EAA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AAO,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,eA2C3D,CAAA"}
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
pageSession: watcher.session,
|
|
44
|
+
stop: watcher.stop,
|
|
45
|
+
// CDP mode doesn't support listTargets/attachTarget/detachTarget
|
|
46
|
+
// (auto-attaches based on match criteria)
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
//# 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,WAAW,EAAE,OAAO,CAAC,OAAO;QAC5B,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,iEAAiE;QACjE,0CAA0C;KAC1C,CAAA;AACF,CAAC,CAAA"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { CdpSourceTarget } from './types.js';
|
|
2
|
+
type SessionSummary = {
|
|
3
|
+
tabId: number;
|
|
4
|
+
url: string;
|
|
5
|
+
title: string;
|
|
6
|
+
faviconUrl?: string;
|
|
7
|
+
};
|
|
8
|
+
export type ExtensionFrameState = {
|
|
9
|
+
topFrameId: string | null;
|
|
10
|
+
requestedFrameId: string | null;
|
|
11
|
+
activeFrameId: string | null;
|
|
12
|
+
activeAttachedAt: number | null;
|
|
13
|
+
frames: Map<string, ExtensionFrame>;
|
|
14
|
+
executionContexts: Map<string, number>;
|
|
15
|
+
pendingTitleLoads: Set<string>;
|
|
16
|
+
};
|
|
17
|
+
export type ExtensionFrame = {
|
|
18
|
+
frameId: string;
|
|
19
|
+
parentFrameId: string | null;
|
|
20
|
+
url: string;
|
|
21
|
+
title: string | null;
|
|
22
|
+
sessionId: string | null;
|
|
23
|
+
};
|
|
24
|
+
export type CdpFrameTreeNode = {
|
|
25
|
+
frame?: {
|
|
26
|
+
id?: string;
|
|
27
|
+
parentId?: string;
|
|
28
|
+
url?: string;
|
|
29
|
+
name?: string;
|
|
30
|
+
};
|
|
31
|
+
childFrames?: CdpFrameTreeNode[];
|
|
32
|
+
};
|
|
33
|
+
export declare const createEmptyFrameState: () => ExtensionFrameState;
|
|
34
|
+
export declare const createNotAttachedError: () => Error;
|
|
35
|
+
export declare const formatPageTargetId: (tabId: number) => string;
|
|
36
|
+
export declare const formatFrameTargetId: (tabId: number, frameId: string) => string;
|
|
37
|
+
export declare const parseExtensionTargetId: (targetId: string) => {
|
|
38
|
+
tabId: number;
|
|
39
|
+
frameId: string | null;
|
|
40
|
+
};
|
|
41
|
+
export declare const buildPageTarget: (session: SessionSummary, options: {
|
|
42
|
+
attached: boolean;
|
|
43
|
+
}) => CdpSourceTarget;
|
|
44
|
+
export declare const frameToTarget: (tabId: number, frame: ExtensionFrame, options: {
|
|
45
|
+
attached: boolean;
|
|
46
|
+
faviconUrl?: string;
|
|
47
|
+
topFrameId: string | null;
|
|
48
|
+
}) => CdpSourceTarget;
|
|
49
|
+
export declare const buildFrameTargets: (state: ExtensionFrameState, tabId: number, activeFrameId: string | null, faviconUrl?: string) => CdpSourceTarget[];
|
|
50
|
+
export declare const collectFrameTree: (node: CdpFrameTreeNode | undefined, state: ExtensionFrameState) => void;
|
|
51
|
+
export declare const parseFrame: (params: unknown) => ExtensionFrame | null;
|
|
52
|
+
export declare const parseExecutionContext: (params: unknown) => {
|
|
53
|
+
id: number;
|
|
54
|
+
frameId: string | null;
|
|
55
|
+
isDefault: boolean;
|
|
56
|
+
} | null;
|
|
57
|
+
/**
|
|
58
|
+
* Selection is about the user's intended target, not whether every frame-scoped command is ready.
|
|
59
|
+
* Once the watcher knows the frame exists we can switch the active target; commands that require
|
|
60
|
+
* an execution context still guard that separately at execution time.
|
|
61
|
+
*/
|
|
62
|
+
export declare const resolveRequestedFrameId: (state: ExtensionFrameState, requestedFrameId: string | null) => string | null;
|
|
63
|
+
export {};
|
|
64
|
+
//# sourceMappingURL=extension-frame-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extension-frame-state.d.ts","sourceRoot":"","sources":["../../src/sources/extension-frame-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAEjD,KAAK,cAAc,GAAG;IACrB,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IACjC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CAAA;IACnC,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACtC,iBAAiB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAC9B,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAA;IACf,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,SAAS,EAAE,MAA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eAAO,MAAM,UAAU,GAAI,QAAQ,OAAO,KAAG,cAAc,GAAG,IAc7D,CAAA;AAED,eAAO,MAAM,qBAAqB,GAAI,QAAQ,OAAO,KAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE,GAAG,IAgBpH,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,GAAI,OAAO,mBAAmB,EAAE,kBAAkB,MAAM,GAAG,IAAI,KAAG,MAAM,GAAG,IAM9G,CAAA"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
export const createEmptyFrameState = () => ({
|
|
2
|
+
topFrameId: null,
|
|
3
|
+
requestedFrameId: null,
|
|
4
|
+
activeFrameId: null,
|
|
5
|
+
activeAttachedAt: null,
|
|
6
|
+
frames: new Map(),
|
|
7
|
+
executionContexts: new Map(),
|
|
8
|
+
pendingTitleLoads: new Set(),
|
|
9
|
+
});
|
|
10
|
+
export const createNotAttachedError = () => {
|
|
11
|
+
const error = new Error('No tab attached via extension');
|
|
12
|
+
error.code = 'cdp_not_attached';
|
|
13
|
+
return error;
|
|
14
|
+
};
|
|
15
|
+
export const formatPageTargetId = (tabId) => `tab:${tabId}`;
|
|
16
|
+
export const formatFrameTargetId = (tabId, frameId) => `frame:${tabId}:${frameId}`;
|
|
17
|
+
export const parseExtensionTargetId = (targetId) => {
|
|
18
|
+
if (targetId.startsWith('tab:')) {
|
|
19
|
+
const tabId = Number.parseInt(targetId.slice(4), 10);
|
|
20
|
+
if (Number.isFinite(tabId)) {
|
|
21
|
+
return { tabId, frameId: null };
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
if (targetId.startsWith('frame:')) {
|
|
25
|
+
const [, tabIdRaw, ...frameIdParts] = targetId.split(':');
|
|
26
|
+
const tabId = Number.parseInt(tabIdRaw ?? '', 10);
|
|
27
|
+
const frameId = frameIdParts.join(':');
|
|
28
|
+
if (Number.isFinite(tabId) && frameId) {
|
|
29
|
+
return { tabId, frameId };
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const legacyTabId = Number.parseInt(targetId, 10);
|
|
33
|
+
if (Number.isFinite(legacyTabId)) {
|
|
34
|
+
return { tabId: legacyTabId, frameId: null };
|
|
35
|
+
}
|
|
36
|
+
throw new Error(`Invalid extension target id: ${targetId}`);
|
|
37
|
+
};
|
|
38
|
+
export const buildPageTarget = (session, options) => ({
|
|
39
|
+
id: formatPageTargetId(session.tabId),
|
|
40
|
+
title: session.title,
|
|
41
|
+
url: session.url,
|
|
42
|
+
type: 'page',
|
|
43
|
+
parentId: null,
|
|
44
|
+
faviconUrl: session.faviconUrl,
|
|
45
|
+
attached: options.attached,
|
|
46
|
+
});
|
|
47
|
+
export const frameToTarget = (tabId, frame, options) => ({
|
|
48
|
+
id: formatFrameTargetId(tabId, frame.frameId),
|
|
49
|
+
title: frame.title ?? frame.url ?? `iframe ${frame.frameId}`,
|
|
50
|
+
url: frame.url,
|
|
51
|
+
type: 'iframe',
|
|
52
|
+
parentId: frame.parentFrameId && frame.parentFrameId !== options.topFrameId
|
|
53
|
+
? formatFrameTargetId(tabId, frame.parentFrameId)
|
|
54
|
+
: formatPageTargetId(tabId),
|
|
55
|
+
faviconUrl: options.faviconUrl,
|
|
56
|
+
attached: options.attached,
|
|
57
|
+
});
|
|
58
|
+
export const buildFrameTargets = (state, tabId, activeFrameId, faviconUrl) => [...state.frames.values()]
|
|
59
|
+
.filter((frame) => frame.frameId !== state.topFrameId)
|
|
60
|
+
.map((frame) => frameToTarget(tabId, frame, { attached: frame.frameId === activeFrameId, faviconUrl, topFrameId: state.topFrameId }));
|
|
61
|
+
export const collectFrameTree = (node, state) => {
|
|
62
|
+
if (!node?.frame?.id) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
const frameId = node.frame.id;
|
|
66
|
+
state.frames.set(frameId, {
|
|
67
|
+
frameId,
|
|
68
|
+
parentFrameId: node.frame.parentId ?? null,
|
|
69
|
+
url: node.frame.url ?? '',
|
|
70
|
+
title: node.frame.name ?? null,
|
|
71
|
+
sessionId: state.frames.get(frameId)?.sessionId ?? null,
|
|
72
|
+
});
|
|
73
|
+
if (!node.frame.parentId) {
|
|
74
|
+
state.topFrameId = frameId;
|
|
75
|
+
}
|
|
76
|
+
for (const child of node.childFrames ?? []) {
|
|
77
|
+
collectFrameTree(child, state);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
export const parseFrame = (params) => {
|
|
81
|
+
const record = params;
|
|
82
|
+
const frameId = record.frame?.id;
|
|
83
|
+
const url = record.frame?.url;
|
|
84
|
+
if (!frameId || !url || typeof url !== 'string' || url.trim() === '') {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
frameId,
|
|
89
|
+
parentFrameId: record.frame?.parentId ?? null,
|
|
90
|
+
url,
|
|
91
|
+
title: record.frame?.name ?? null,
|
|
92
|
+
sessionId: null,
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
export const parseExecutionContext = (params) => {
|
|
96
|
+
const record = params;
|
|
97
|
+
if (record.context?.id == null) {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
id: record.context.id,
|
|
102
|
+
frameId: record.context.auxData?.frameId ?? null,
|
|
103
|
+
isDefault: record.context.auxData?.isDefault === true,
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* Selection is about the user's intended target, not whether every frame-scoped command is ready.
|
|
108
|
+
* Once the watcher knows the frame exists we can switch the active target; commands that require
|
|
109
|
+
* an execution context still guard that separately at execution time.
|
|
110
|
+
*/
|
|
111
|
+
export const resolveRequestedFrameId = (state, requestedFrameId) => {
|
|
112
|
+
if (!requestedFrameId) {
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
return state.frames.has(requestedFrameId) ? requestedFrameId : null;
|
|
116
|
+
};
|
|
117
|
+
//# sourceMappingURL=extension-frame-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extension-frame-state.js","sourceRoot":"","sources":["../../src/sources/extension-frame-state.ts"],"names":[],"mappings":"AAqCA,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAwB,EAAE,CAAC,CAAC;IAChE,UAAU,EAAE,IAAI;IAChB,gBAAgB,EAAE,IAAI;IACtB,aAAa,EAAE,IAAI;IACnB,gBAAgB,EAAE,IAAI;IACtB,MAAM,EAAE,IAAI,GAAG,EAAE;IACjB,iBAAiB,EAAE,IAAI,GAAG,EAAE;IAC5B,iBAAiB,EAAE,IAAI,GAAG,EAAE;CAC5B,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAU,EAAE;IACjD,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,+BAA+B,CAAC,CACvD;IAAC,KAAmC,CAAC,IAAI,GAAG,kBAAkB,CAAA;IAC/D,OAAO,KAAK,CAAA;AACb,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,OAAO,KAAK,EAAE,CAAA;AAE3E,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,KAAa,EAAE,OAAe,EAAU,EAAE,CAAC,SAAS,KAAK,IAAI,OAAO,EAAE,CAAA;AAE1G,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,QAAgB,EAA6C,EAAE;IACrG,IAAI,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QACjC,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;QACpD,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YAC5B,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,CAAA;QAChC,CAAC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M,qBAAqB,GAAG,CAAC,MAAe,EAAqE,EAAE;IAC3H,MAAM,MAAM,GAAG,MAKd,CAAA;IACD,IAAI,MAAM,CAAC,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,CAAC;QAChC,OAAO,IAAI,CAAA;IACZ,CAAC;IAED,OAAO;QACN,EAAE,EAAE,MAAM,CAAC,OAAO,CAAC,EAAE;QACrB,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,IAAI,IAAI;QAChD,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,SAAS,KAAK,IAAI;KACrD,CAAA;AACF,CAAC,CAAA;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,KAA0B,EAAE,gBAA+B,EAAiB,EAAE;IACrH,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACvB,OAAO,IAAI,CAAA;IACZ,CAAC;IAED,OAAO,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAAA;AACpE,CAAC,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { LogEvent } from '@vforsh/argus-core';
|
|
2
|
+
type SessionSummary = {
|
|
3
|
+
url: string;
|
|
4
|
+
title: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const toConsoleEvent: (params: unknown, session: SessionSummary, config: {
|
|
7
|
+
ignoreMatcher?: ((url: string) => boolean) | null;
|
|
8
|
+
stripUrlPrefixes?: string[];
|
|
9
|
+
}) => Omit<LogEvent, "id">;
|
|
10
|
+
export declare const toExceptionEvent: (params: unknown, session: SessionSummary, config: {
|
|
11
|
+
ignoreMatcher?: ((url: string) => boolean) | null;
|
|
12
|
+
stripUrlPrefixes?: string[];
|
|
13
|
+
}) => Omit<LogEvent, "id">;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=extension-log-events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extension-log-events.d.ts","sourceRoot":"","sources":["../../src/sources/extension-log-events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAY,MAAM,oBAAoB,CAAA;AAG5D,KAAK,cAAc,GAAG;IACrB,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;CACb,CAAA;AAED,eAAO,MAAM,cAAc,GAC1B,QAAQ,OAAO,EACf,SAAS,cAAc,EACvB,QAAQ;IAAE,aAAa,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,IAAI,CAAC;IAAC,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,KACxF,IAAI,CAAC,QAAQ,EAAE,IAAI,CAwBrB,CAAA;AAED,eAAO,MAAM,gBAAgB,GAC5B,QAAQ,OAAO,EACf,SAAS,cAAc,EACvB,QAAQ;IAAE,aAAa,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,IAAI,CAAC;IAAC,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,KACxF,IAAI,CAAC,QAAQ,EAAE,IAAI,CA2BrB,CAAA"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { previewStringify } from '@vforsh/argus-core';
|
|
2
|
+
export const toConsoleEvent = (params, session, config) => {
|
|
3
|
+
const record = params;
|
|
4
|
+
const args = record.args?.map((arg) => arg.value) ?? [];
|
|
5
|
+
const text = formatArgs(record.args ?? []);
|
|
6
|
+
const frame = selectBestFrame(record.stackTrace?.callFrames, config.ignoreMatcher);
|
|
7
|
+
return {
|
|
8
|
+
ts: record.timestamp ?? Date.now(),
|
|
9
|
+
level: normalizeLevel(record.type ?? 'log'),
|
|
10
|
+
text,
|
|
11
|
+
args,
|
|
12
|
+
source: 'console',
|
|
13
|
+
file: applyStripPrefixes(frame?.url ?? null, config.stripUrlPrefixes),
|
|
14
|
+
line: frame?.lineNumber != null ? frame.lineNumber + 1 : null,
|
|
15
|
+
column: frame?.columnNumber != null ? frame.columnNumber + 1 : null,
|
|
16
|
+
pageUrl: session.url,
|
|
17
|
+
pageTitle: session.title,
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export const toExceptionEvent = (params, session, config) => {
|
|
21
|
+
const record = params;
|
|
22
|
+
const details = record.exceptionDetails;
|
|
23
|
+
const text = details?.exception?.description ?? details?.text ?? 'Exception';
|
|
24
|
+
const args = details?.exception ? [details.exception.value ?? details.exception.description] : [];
|
|
25
|
+
const frame = selectBestFrame(details?.stackTrace?.callFrames, config.ignoreMatcher);
|
|
26
|
+
return {
|
|
27
|
+
ts: record.timestamp ?? Date.now(),
|
|
28
|
+
level: 'exception',
|
|
29
|
+
text,
|
|
30
|
+
args,
|
|
31
|
+
source: 'exception',
|
|
32
|
+
file: applyStripPrefixes(frame?.url ?? null, config.stripUrlPrefixes),
|
|
33
|
+
line: frame?.lineNumber != null ? frame.lineNumber + 1 : null,
|
|
34
|
+
column: frame?.columnNumber != null ? frame.columnNumber + 1 : null,
|
|
35
|
+
pageUrl: session.url,
|
|
36
|
+
pageTitle: session.title,
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
const formatArgs = (args) => {
|
|
40
|
+
if (args.length === 0) {
|
|
41
|
+
return '';
|
|
42
|
+
}
|
|
43
|
+
return args
|
|
44
|
+
.map((arg) => {
|
|
45
|
+
if (arg.value !== undefined) {
|
|
46
|
+
return typeof arg.value === 'string' ? arg.value : previewStringify(arg.value);
|
|
47
|
+
}
|
|
48
|
+
return arg.description ?? `[${arg.type}]`;
|
|
49
|
+
})
|
|
50
|
+
.join(' ');
|
|
51
|
+
};
|
|
52
|
+
const normalizeLevel = (type) => {
|
|
53
|
+
switch (type) {
|
|
54
|
+
case 'log':
|
|
55
|
+
case 'info':
|
|
56
|
+
case 'debug':
|
|
57
|
+
case 'dir':
|
|
58
|
+
case 'dirxml':
|
|
59
|
+
case 'table':
|
|
60
|
+
case 'trace':
|
|
61
|
+
case 'count':
|
|
62
|
+
case 'timeEnd':
|
|
63
|
+
case 'timeLog':
|
|
64
|
+
return type === 'debug' ? 'debug' : type === 'info' ? 'info' : 'log';
|
|
65
|
+
case 'warn':
|
|
66
|
+
case 'warning':
|
|
67
|
+
return 'warning';
|
|
68
|
+
case 'error':
|
|
69
|
+
case 'assert':
|
|
70
|
+
case 'exception':
|
|
71
|
+
return type === 'exception' ? 'exception' : 'error';
|
|
72
|
+
default:
|
|
73
|
+
return 'log';
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
const selectBestFrame = (frames, ignoreMatcher) => {
|
|
77
|
+
if (!frames || frames.length === 0) {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
if (!ignoreMatcher) {
|
|
81
|
+
return frames[0] ?? null;
|
|
82
|
+
}
|
|
83
|
+
for (const frame of frames) {
|
|
84
|
+
if (frame.url && !ignoreMatcher(frame.url)) {
|
|
85
|
+
return frame;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return frames[0] ?? null;
|
|
89
|
+
};
|
|
90
|
+
const applyStripPrefixes = (file, prefixes) => {
|
|
91
|
+
if (!file || !prefixes || prefixes.length === 0) {
|
|
92
|
+
return file;
|
|
93
|
+
}
|
|
94
|
+
for (const prefix of prefixes) {
|
|
95
|
+
if (file.startsWith(prefix)) {
|
|
96
|
+
return file.slice(prefix.length);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return file;
|
|
100
|
+
};
|
|
101
|
+
//# sourceMappingURL=extension-log-events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extension-log-events.js","sourceRoot":"","sources":["../../src/sources/extension-log-events.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAOrD,MAAM,CAAC,MAAM,cAAc,GAAG,CAC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CAAC;IAED,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC5B,IAAI,KAAK,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;YAC5C,OAAO,KAAK,CAAA;QACb,CAAC;IACF,CAAC;IAED,OAAO,MAAM,CAAC,CAAC,CAAC,IAAI,IAAI,CAAA;AACzB,CAAC,CAAA;AAED,MAAM,kBAAkB,GAAG,CAAC,IAAmB,EAAE,QAA8B,EAAiB,EAAE;IACjG,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACjD,OAAO,IAAI,CAAA;IACZ,CAAC;IAED,KAAK,MAAM,MAAM,IAAI,QAAQ,EAAE,CAAC;QAC/B,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;YAC7B,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;QACjC,CAAC;IACF,CAAC;IAED,OAAO,IAAI,CAAA;AACZ,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;AAKH,OAAO,KAAK,EAAE,eAAe,EAAmB,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAmBxF;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,oBAAoB,CAAA;AAEzD;;;GAGG;AACH,eAAO,MAAM,qBAAqB,GAAI,SAAS,sBAAsB,KAAG,eAmhBvE,CAAA"}
|