superbased 1.6.4 → 2.0.1
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 +230 -36
- package/SUPERBASED_SKILL.md +1196 -22
- package/dist/electron/core/input-injection/index.d.ts +6 -0
- package/dist/electron/core/input-injection/index.d.ts.map +1 -0
- package/dist/electron/core/input-injection/index.js +31 -0
- package/dist/electron/core/input-injection/index.js.map +1 -0
- package/dist/electron/core/input-injection/macos.d.ts +3 -0
- package/dist/electron/core/input-injection/macos.d.ts.map +1 -0
- package/dist/electron/core/input-injection/macos.js +14 -0
- package/dist/electron/core/input-injection/macos.js.map +1 -0
- package/dist/electron/core/input-injection/windows.d.ts +3 -0
- package/dist/electron/core/input-injection/windows.d.ts.map +1 -0
- package/dist/electron/core/input-injection/windows.js +119 -0
- package/dist/electron/core/input-injection/windows.js.map +1 -0
- package/dist/electron/core/json-store.d.ts +22 -0
- package/dist/electron/core/json-store.d.ts.map +1 -1
- package/dist/electron/core/json-store.js +61 -47
- package/dist/electron/core/json-store.js.map +1 -1
- package/dist/electron/core/platform.d.ts +1 -0
- package/dist/electron/core/platform.d.ts.map +1 -1
- package/dist/electron/core/serialize-schema.d.ts +35 -0
- package/dist/electron/core/serialize-schema.d.ts.map +1 -0
- package/dist/electron/core/serialize-schema.js +89 -0
- package/dist/electron/core/serialize-schema.js.map +1 -0
- package/dist/electron/core/settings-schema.d.ts +81 -0
- package/dist/electron/core/settings-schema.d.ts.map +1 -0
- package/dist/electron/core/settings-schema.js +1357 -0
- package/dist/electron/core/settings-schema.js.map +1 -0
- package/dist/electron/logger.d.ts.map +1 -1
- package/dist/electron/logger.js +22 -8
- package/dist/electron/logger.js.map +1 -1
- package/dist/electron/main.js +417 -133
- package/dist/electron/modules/accessibility/macos-provider.d.ts +8 -0
- package/dist/electron/modules/accessibility/macos-provider.d.ts.map +1 -0
- package/dist/electron/modules/accessibility/macos-provider.js +94 -0
- package/dist/electron/modules/accessibility/macos-provider.js.map +1 -0
- package/dist/electron/modules/accessibility/provider.d.ts +12 -0
- package/dist/electron/modules/accessibility/provider.d.ts.map +1 -0
- package/dist/electron/modules/accessibility/provider.js +52 -0
- package/dist/electron/modules/accessibility/provider.js.map +1 -0
- package/dist/electron/modules/accessibility/types.d.ts +63 -0
- package/dist/electron/modules/accessibility/types.d.ts.map +1 -0
- package/dist/electron/modules/accessibility/types.js +6 -0
- package/dist/electron/modules/accessibility/types.js.map +1 -0
- package/dist/electron/modules/accessibility/windows-provider.d.ts +8 -0
- package/dist/electron/modules/accessibility/windows-provider.d.ts.map +1 -0
- package/dist/electron/modules/accessibility/windows-provider.js +85 -0
- package/dist/electron/modules/accessibility/windows-provider.js.map +1 -0
- package/dist/electron/modules/api-server.d.ts +4 -1
- package/dist/electron/modules/api-server.d.ts.map +1 -1
- package/dist/electron/modules/api-server.js +1349 -219
- package/dist/electron/modules/api-server.js.map +1 -1
- package/dist/electron/modules/auth.d.ts +14 -0
- package/dist/electron/modules/auth.d.ts.map +1 -1
- package/dist/electron/modules/auth.js +43 -0
- package/dist/electron/modules/auth.js.map +1 -1
- package/dist/electron/modules/azure-speech-realtime.d.ts.map +1 -1
- package/dist/electron/modules/azure-speech-realtime.js +56 -0
- package/dist/electron/modules/azure-speech-realtime.js.map +1 -1
- package/dist/electron/modules/capture.d.ts +8 -0
- package/dist/electron/modules/capture.d.ts.map +1 -1
- package/dist/electron/modules/capture.js +33 -0
- package/dist/electron/modules/capture.js.map +1 -1
- package/dist/electron/modules/compose-screenshots.d.ts +8 -0
- package/dist/electron/modules/compose-screenshots.d.ts.map +1 -0
- package/dist/electron/modules/compose-screenshots.js +86 -0
- package/dist/electron/modules/compose-screenshots.js.map +1 -0
- package/dist/electron/modules/context-menu-detect.d.ts +47 -0
- package/dist/electron/modules/context-menu-detect.d.ts.map +1 -0
- package/dist/electron/modules/context-menu-detect.js +272 -0
- package/dist/electron/modules/context-menu-detect.js.map +1 -0
- package/dist/electron/modules/dictation.d.ts.map +1 -1
- package/dist/electron/modules/dictation.js +12 -7
- package/dist/electron/modules/dictation.js.map +1 -1
- package/dist/electron/modules/gif-util.d.ts +9 -0
- package/dist/electron/modules/gif-util.d.ts.map +1 -0
- package/dist/electron/modules/gif-util.js +63 -0
- package/dist/electron/modules/gif-util.js.map +1 -0
- package/dist/electron/modules/gui-automation-errors.d.ts +11 -0
- package/dist/electron/modules/gui-automation-errors.d.ts.map +1 -0
- package/dist/electron/modules/gui-automation-errors.js +79 -0
- package/dist/electron/modules/gui-automation-errors.js.map +1 -0
- package/dist/electron/modules/gui-automation-telemetry.d.ts +38 -0
- package/dist/electron/modules/gui-automation-telemetry.d.ts.map +1 -0
- package/dist/electron/modules/gui-automation-telemetry.js +200 -0
- package/dist/electron/modules/gui-automation-telemetry.js.map +1 -0
- package/dist/electron/modules/gui-automation.d.ts +1143 -0
- package/dist/electron/modules/gui-automation.d.ts.map +1 -0
- package/dist/electron/modules/gui-automation.js +8769 -0
- package/dist/electron/modules/gui-automation.js.map +1 -0
- package/dist/electron/modules/hotkeys.d.ts +2 -1
- package/dist/electron/modules/hotkeys.d.ts.map +1 -1
- package/dist/electron/modules/hotkeys.js +25 -1
- package/dist/electron/modules/hotkeys.js.map +1 -1
- package/dist/electron/modules/human-input/index.d.ts +35 -0
- package/dist/electron/modules/human-input/index.d.ts.map +1 -0
- package/dist/electron/modules/human-input/index.js +163 -0
- package/dist/electron/modules/human-input/index.js.map +1 -0
- package/dist/electron/modules/human-input/keyboard/timing.d.ts +38 -0
- package/dist/electron/modules/human-input/keyboard/timing.d.ts.map +1 -0
- package/dist/electron/modules/human-input/keyboard/timing.js +57 -0
- package/dist/electron/modules/human-input/keyboard/timing.js.map +1 -0
- package/dist/electron/modules/human-input/mouse/path.d.ts +24 -0
- package/dist/electron/modules/human-input/mouse/path.d.ts.map +1 -0
- package/dist/electron/modules/human-input/mouse/path.js +80 -0
- package/dist/electron/modules/human-input/mouse/path.js.map +1 -0
- package/dist/electron/modules/human-input/mouse/velocity.d.ts +48 -0
- package/dist/electron/modules/human-input/mouse/velocity.d.ts.map +1 -0
- package/dist/electron/modules/human-input/mouse/velocity.js +93 -0
- package/dist/electron/modules/human-input/mouse/velocity.js.map +1 -0
- package/dist/electron/modules/human-input/profiles.d.ts +90 -0
- package/dist/electron/modules/human-input/profiles.d.ts.map +1 -0
- package/dist/electron/modules/human-input/profiles.js +124 -0
- package/dist/electron/modules/human-input/profiles.js.map +1 -0
- package/dist/electron/modules/human-input/rng.d.ts +16 -0
- package/dist/electron/modules/human-input/rng.d.ts.map +1 -0
- package/dist/electron/modules/human-input/rng.js +101 -0
- package/dist/electron/modules/human-input/rng.js.map +1 -0
- package/dist/electron/modules/human-input/salt.d.ts +15 -0
- package/dist/electron/modules/human-input/salt.d.ts.map +1 -0
- package/dist/electron/modules/human-input/salt.js +48 -0
- package/dist/electron/modules/human-input/salt.js.map +1 -0
- package/dist/electron/modules/image-utils.d.ts +20 -0
- package/dist/electron/modules/image-utils.d.ts.map +1 -0
- package/dist/electron/modules/image-utils.js +80 -0
- package/dist/electron/modules/image-utils.js.map +1 -0
- package/dist/electron/modules/ollama/capability.d.ts +32 -0
- package/dist/electron/modules/ollama/capability.d.ts.map +1 -0
- package/dist/electron/modules/ollama/capability.js +117 -0
- package/dist/electron/modules/ollama/capability.js.map +1 -0
- package/dist/electron/modules/ollama/client.d.ts +14 -0
- package/dist/electron/modules/ollama/client.d.ts.map +1 -0
- package/dist/electron/modules/ollama/client.js +134 -0
- package/dist/electron/modules/ollama/client.js.map +1 -0
- package/dist/electron/modules/ollama/detector.d.ts +29 -0
- package/dist/electron/modules/ollama/detector.d.ts.map +1 -0
- package/dist/electron/modules/ollama/detector.js +177 -0
- package/dist/electron/modules/ollama/detector.js.map +1 -0
- package/dist/electron/modules/ollama/dispatcher.d.ts +36 -0
- package/dist/electron/modules/ollama/dispatcher.d.ts.map +1 -0
- package/dist/electron/modules/ollama/dispatcher.js +97 -0
- package/dist/electron/modules/ollama/dispatcher.js.map +1 -0
- package/dist/electron/modules/ollama/router.d.ts +51 -0
- package/dist/electron/modules/ollama/router.d.ts.map +1 -0
- package/dist/electron/modules/ollama/router.js +201 -0
- package/dist/electron/modules/ollama/router.js.map +1 -0
- package/dist/electron/modules/pin-window.d.ts.map +1 -1
- package/dist/electron/modules/pin-window.js +2 -1
- package/dist/electron/modules/pin-window.js.map +1 -1
- package/dist/electron/modules/platform/dpi.d.ts +2 -0
- package/dist/electron/modules/platform/dpi.d.ts.map +1 -0
- package/dist/electron/modules/platform/dpi.js +48 -0
- package/dist/electron/modules/platform/dpi.js.map +1 -0
- package/dist/electron/modules/platform/errors.d.ts +13 -0
- package/dist/electron/modules/platform/errors.d.ts.map +1 -0
- package/dist/electron/modules/platform/errors.js +36 -0
- package/dist/electron/modules/platform/errors.js.map +1 -0
- package/dist/electron/modules/platform/index.d.ts +24 -0
- package/dist/electron/modules/platform/index.d.ts.map +1 -0
- package/dist/electron/modules/platform/index.js +133 -0
- package/dist/electron/modules/platform/index.js.map +1 -0
- package/dist/electron/modules/platform/interfaces.d.ts +140 -0
- package/dist/electron/modules/platform/interfaces.d.ts.map +1 -0
- package/dist/electron/modules/platform/interfaces.js +14 -0
- package/dist/electron/modules/platform/interfaces.js.map +1 -0
- package/dist/electron/modules/platform/macos/ax.d.ts +15 -0
- package/dist/electron/modules/platform/macos/ax.d.ts.map +1 -0
- package/dist/electron/modules/platform/macos/ax.js +222 -0
- package/dist/electron/modules/platform/macos/ax.js.map +1 -0
- package/dist/electron/modules/platform/macos/capture.d.ts +14 -0
- package/dist/electron/modules/platform/macos/capture.d.ts.map +1 -0
- package/dist/electron/modules/platform/macos/capture.js +106 -0
- package/dist/electron/modules/platform/macos/capture.js.map +1 -0
- package/dist/electron/modules/platform/macos/input.d.ts +16 -0
- package/dist/electron/modules/platform/macos/input.d.ts.map +1 -0
- package/dist/electron/modules/platform/macos/input.js +342 -0
- package/dist/electron/modules/platform/macos/input.js.map +1 -0
- package/dist/electron/modules/platform/macos/launch.d.ts +10 -0
- package/dist/electron/modules/platform/macos/launch.d.ts.map +1 -0
- package/dist/electron/modules/platform/macos/launch.js +114 -0
- package/dist/electron/modules/platform/macos/launch.js.map +1 -0
- package/dist/electron/modules/platform/macos/session.d.ts +8 -0
- package/dist/electron/modules/platform/macos/session.d.ts.map +1 -0
- package/dist/electron/modules/platform/macos/session.js +17 -0
- package/dist/electron/modules/platform/macos/session.js.map +1 -0
- package/dist/electron/modules/platform/macos/window.d.ts +31 -0
- package/dist/electron/modules/platform/macos/window.d.ts.map +1 -0
- package/dist/electron/modules/platform/macos/window.js +271 -0
- package/dist/electron/modules/platform/macos/window.js.map +1 -0
- package/dist/electron/modules/platform/shared.d.ts +10 -0
- package/dist/electron/modules/platform/shared.d.ts.map +1 -0
- package/dist/electron/modules/platform/shared.js +201 -0
- package/dist/electron/modules/platform/shared.js.map +1 -0
- package/dist/electron/modules/platform/types.d.ts +182 -0
- package/dist/electron/modules/platform/types.d.ts.map +1 -0
- package/dist/electron/modules/platform/types.js +24 -0
- package/dist/electron/modules/platform/types.js.map +1 -0
- package/dist/electron/modules/platform/windows/ax.d.ts +15 -0
- package/dist/electron/modules/platform/windows/ax.d.ts.map +1 -0
- package/dist/electron/modules/platform/windows/ax.js +277 -0
- package/dist/electron/modules/platform/windows/ax.js.map +1 -0
- package/dist/electron/modules/platform/windows/capture.d.ts +14 -0
- package/dist/electron/modules/platform/windows/capture.d.ts.map +1 -0
- package/dist/electron/modules/platform/windows/capture.js +115 -0
- package/dist/electron/modules/platform/windows/capture.js.map +1 -0
- package/dist/electron/modules/platform/windows/input.d.ts +17 -0
- package/dist/electron/modules/platform/windows/input.d.ts.map +1 -0
- package/dist/electron/modules/platform/windows/input.js +422 -0
- package/dist/electron/modules/platform/windows/input.js.map +1 -0
- package/dist/electron/modules/platform/windows/launch.d.ts +10 -0
- package/dist/electron/modules/platform/windows/launch.d.ts.map +1 -0
- package/dist/electron/modules/platform/windows/launch.js +185 -0
- package/dist/electron/modules/platform/windows/launch.js.map +1 -0
- package/dist/electron/modules/platform/windows/session.d.ts +8 -0
- package/dist/electron/modules/platform/windows/session.d.ts.map +1 -0
- package/dist/electron/modules/platform/windows/session.js +87 -0
- package/dist/electron/modules/platform/windows/session.js.map +1 -0
- package/dist/electron/modules/platform/windows/tray.d.ts +13 -0
- package/dist/electron/modules/platform/windows/tray.d.ts.map +1 -0
- package/dist/electron/modules/platform/windows/tray.js +390 -0
- package/dist/electron/modules/platform/windows/tray.js.map +1 -0
- package/dist/electron/modules/platform/windows/window.d.ts +30 -0
- package/dist/electron/modules/platform/windows/window.d.ts.map +1 -0
- package/dist/electron/modules/platform/windows/window.js +444 -0
- package/dist/electron/modules/platform/windows/window.js.map +1 -0
- package/dist/electron/modules/recording/providers/change-detect-shared-wrapper.d.ts +15 -0
- package/dist/electron/modules/recording/providers/change-detect-shared-wrapper.d.ts.map +1 -0
- package/dist/electron/modules/recording/providers/change-detect-shared-wrapper.js +62 -0
- package/dist/electron/modules/recording/providers/change-detect-shared-wrapper.js.map +1 -0
- package/dist/electron/modules/recording/providers/provider-factory.d.ts.map +1 -1
- package/dist/electron/modules/recording/providers/provider-factory.js +13 -7
- package/dist/electron/modules/recording/providers/provider-factory.js.map +1 -1
- package/dist/electron/modules/scroll-calibration.d.ts +152 -0
- package/dist/electron/modules/scroll-calibration.d.ts.map +1 -0
- package/dist/electron/modules/scroll-calibration.js +271 -0
- package/dist/electron/modules/scroll-calibration.js.map +1 -0
- package/dist/electron/modules/scroll-capture.d.ts +3 -1
- package/dist/electron/modules/scroll-capture.d.ts.map +1 -1
- package/dist/electron/modules/scroll-capture.js +21 -72
- package/dist/electron/modules/scroll-capture.js.map +1 -1
- package/dist/electron/modules/sequence-locate.d.ts +126 -0
- package/dist/electron/modules/sequence-locate.d.ts.map +1 -0
- package/dist/electron/modules/sequence-locate.js +356 -0
- package/dist/electron/modules/sequence-locate.js.map +1 -0
- package/dist/electron/modules/store.d.ts +15 -56
- package/dist/electron/modules/store.d.ts.map +1 -1
- package/dist/electron/modules/store.js +84 -58
- package/dist/electron/modules/store.js.map +1 -1
- package/dist/electron/modules/stt/capability-probe.d.ts +67 -0
- package/dist/electron/modules/stt/capability-probe.d.ts.map +1 -0
- package/dist/electron/modules/stt/capability-probe.js +331 -0
- package/dist/electron/modules/stt/capability-probe.js.map +1 -0
- package/dist/electron/modules/stt/macos-engine.d.ts +20 -0
- package/dist/electron/modules/stt/macos-engine.d.ts.map +1 -0
- package/dist/electron/modules/stt/macos-engine.js +231 -0
- package/dist/electron/modules/stt/macos-engine.js.map +1 -0
- package/dist/electron/modules/stt/model-manager.d.ts +87 -0
- package/dist/electron/modules/stt/model-manager.d.ts.map +1 -0
- package/dist/electron/modules/stt/model-manager.js +321 -0
- package/dist/electron/modules/stt/model-manager.js.map +1 -0
- package/dist/electron/modules/stt/router.d.ts +35 -0
- package/dist/electron/modules/stt/router.d.ts.map +1 -0
- package/dist/electron/modules/stt/router.js +232 -0
- package/dist/electron/modules/stt/router.js.map +1 -0
- package/dist/electron/modules/stt/sherpa-engine.d.ts +43 -0
- package/dist/electron/modules/stt/sherpa-engine.d.ts.map +1 -0
- package/dist/electron/modules/stt/sherpa-engine.js +521 -0
- package/dist/electron/modules/stt/sherpa-engine.js.map +1 -0
- package/dist/electron/modules/stt/types.d.ts +72 -0
- package/dist/electron/modules/stt/types.d.ts.map +1 -0
- package/dist/electron/modules/stt/types.js +16 -0
- package/dist/electron/modules/stt/types.js.map +1 -0
- package/dist/electron/modules/stt/winrt-engine.d.ts +20 -0
- package/dist/electron/modules/stt/winrt-engine.d.ts.map +1 -0
- package/dist/electron/modules/stt/winrt-engine.js +238 -0
- package/dist/electron/modules/stt/winrt-engine.js.map +1 -0
- package/dist/electron/modules/template-match.d.ts +62 -0
- package/dist/electron/modules/template-match.d.ts.map +1 -0
- package/dist/electron/modules/template-match.js +205 -0
- package/dist/electron/modules/template-match.js.map +1 -0
- package/dist/electron/modules/tray.d.ts +2 -0
- package/dist/electron/modules/tray.d.ts.map +1 -1
- package/dist/electron/modules/tray.js +136 -8
- package/dist/electron/modules/tray.js.map +1 -1
- package/dist/electron/modules/undo-stack.d.ts +22 -0
- package/dist/electron/modules/undo-stack.d.ts.map +1 -0
- package/dist/electron/modules/undo-stack.js +41 -0
- package/dist/electron/modules/undo-stack.js.map +1 -0
- package/dist/electron/modules/watchers/active-window-watcher.d.ts +5 -0
- package/dist/electron/modules/watchers/active-window-watcher.d.ts.map +1 -0
- package/dist/electron/modules/watchers/active-window-watcher.js +152 -0
- package/dist/electron/modules/watchers/active-window-watcher.js.map +1 -0
- package/dist/electron/modules/watchers/clipboard-watcher.d.ts +5 -0
- package/dist/electron/modules/watchers/clipboard-watcher.d.ts.map +1 -0
- package/dist/electron/modules/watchers/clipboard-watcher.js +90 -0
- package/dist/electron/modules/watchers/clipboard-watcher.js.map +1 -0
- package/dist/electron/modules/watchers/file-watcher.d.ts +5 -0
- package/dist/electron/modules/watchers/file-watcher.d.ts.map +1 -0
- package/dist/electron/modules/watchers/file-watcher.js +91 -0
- package/dist/electron/modules/watchers/file-watcher.js.map +1 -0
- package/dist/electron/modules/watchers/registry.d.ts +34 -0
- package/dist/electron/modules/watchers/registry.d.ts.map +1 -0
- package/dist/electron/modules/watchers/registry.js +108 -0
- package/dist/electron/modules/watchers/registry.js.map +1 -0
- package/dist/electron/modules/watchers/screen-region-service.d.ts +18 -0
- package/dist/electron/modules/watchers/screen-region-service.d.ts.map +1 -0
- package/dist/electron/modules/watchers/screen-region-service.js +126 -0
- package/dist/electron/modules/watchers/screen-region-service.js.map +1 -0
- package/dist/electron/modules/watchers/screen-region-watcher.d.ts +6 -0
- package/dist/electron/modules/watchers/screen-region-watcher.d.ts.map +1 -0
- package/dist/electron/modules/watchers/screen-region-watcher.js +70 -0
- package/dist/electron/modules/watchers/screen-region-watcher.js.map +1 -0
- package/dist/electron/modules/window-activate.d.ts +103 -0
- package/dist/electron/modules/window-activate.d.ts.map +1 -0
- package/dist/electron/modules/window-activate.js +630 -0
- package/dist/electron/modules/window-activate.js.map +1 -0
- package/dist/electron/modules/window-input.d.ts +43 -0
- package/dist/electron/modules/window-input.d.ts.map +1 -0
- package/dist/electron/modules/window-input.js +623 -0
- package/dist/electron/modules/window-input.js.map +1 -0
- package/dist/electron/modules/window-resolver.d.ts +35 -0
- package/dist/electron/modules/window-resolver.d.ts.map +1 -0
- package/dist/electron/modules/window-resolver.js +210 -0
- package/dist/electron/modules/window-resolver.js.map +1 -0
- package/dist/headless/electron/core/input-injection/index.js +30 -0
- package/dist/headless/electron/core/input-injection/macos.js +13 -0
- package/dist/headless/electron/core/input-injection/windows.js +118 -0
- package/dist/headless/electron/core/json-store.js +61 -47
- package/dist/headless/electron/core/serialize-schema.js +88 -0
- package/dist/headless/electron/core/settings-schema.js +1356 -0
- package/dist/headless/electron/logger.js +22 -8
- package/dist/headless/electron/modules/accessibility/macos-provider.js +93 -0
- package/dist/headless/electron/modules/accessibility/provider.js +51 -0
- package/dist/headless/electron/modules/accessibility/types.js +5 -0
- package/dist/headless/electron/modules/accessibility/windows-provider.js +84 -0
- package/dist/headless/electron/modules/api-server.js +1349 -219
- package/dist/headless/electron/modules/auth.js +43 -0
- package/dist/headless/electron/modules/azure-speech-realtime.js +56 -0
- package/dist/headless/electron/modules/capture.js +33 -0
- package/dist/headless/electron/modules/context-menu-detect.js +271 -0
- package/dist/headless/electron/modules/dictation.js +12 -7
- package/dist/headless/electron/modules/gui-automation-errors.js +78 -0
- package/dist/headless/electron/modules/gui-automation-telemetry.js +199 -0
- package/dist/headless/electron/modules/gui-automation.js +8768 -0
- package/dist/headless/electron/modules/human-input/keyboard/timing.js +56 -0
- package/dist/headless/electron/modules/human-input/mouse/path.js +79 -0
- package/dist/headless/electron/modules/human-input/mouse/velocity.js +92 -0
- package/dist/headless/electron/modules/human-input/profiles.js +123 -0
- package/dist/headless/electron/modules/human-input/rng.js +100 -0
- package/dist/headless/electron/modules/human-input/salt.js +47 -0
- package/dist/headless/electron/modules/image-utils.js +79 -0
- package/dist/headless/electron/modules/ollama/capability.js +116 -0
- package/dist/headless/electron/modules/ollama/client.js +133 -0
- package/dist/headless/electron/modules/ollama/detector.js +176 -0
- package/dist/headless/electron/modules/ollama/dispatcher.js +96 -0
- package/dist/headless/electron/modules/ollama/router.js +200 -0
- package/dist/headless/electron/modules/platform/dpi.js +47 -0
- package/dist/headless/electron/modules/platform/errors.js +35 -0
- package/dist/headless/electron/modules/platform/index.js +132 -0
- package/dist/headless/electron/modules/platform/interfaces.js +13 -0
- package/dist/headless/electron/modules/platform/macos/ax.js +221 -0
- package/dist/headless/electron/modules/platform/macos/capture.js +105 -0
- package/dist/headless/electron/modules/platform/macos/input.js +341 -0
- package/dist/headless/electron/modules/platform/macos/launch.js +113 -0
- package/dist/headless/electron/modules/platform/macos/session.js +16 -0
- package/dist/headless/electron/modules/platform/macos/window.js +270 -0
- package/dist/headless/electron/modules/platform/shared.js +200 -0
- package/dist/headless/electron/modules/platform/types.js +23 -0
- package/dist/headless/electron/modules/platform/windows/ax.js +276 -0
- package/dist/headless/electron/modules/platform/windows/capture.js +114 -0
- package/dist/headless/electron/modules/platform/windows/input.js +421 -0
- package/dist/headless/electron/modules/platform/windows/launch.js +184 -0
- package/dist/headless/electron/modules/platform/windows/session.js +86 -0
- package/dist/headless/electron/modules/platform/windows/tray.js +389 -0
- package/dist/headless/electron/modules/platform/windows/window.js +443 -0
- package/dist/headless/electron/modules/recording/providers/change-detect-shared-wrapper.js +61 -0
- package/dist/headless/electron/modules/recording/providers/provider-factory.js +13 -7
- package/dist/headless/electron/modules/scroll-calibration.js +270 -0
- package/dist/headless/electron/modules/sequence-locate.js +355 -0
- package/dist/headless/electron/modules/store.js +84 -58
- package/dist/headless/electron/modules/stt/capability-probe.js +330 -0
- package/dist/headless/electron/modules/stt/macos-engine.js +230 -0
- package/dist/headless/electron/modules/stt/model-manager.js +320 -0
- package/dist/headless/electron/modules/stt/router.js +231 -0
- package/dist/headless/electron/modules/stt/sherpa-engine.js +520 -0
- package/dist/headless/electron/modules/stt/types.js +15 -0
- package/dist/headless/electron/modules/stt/winrt-engine.js +237 -0
- package/dist/headless/electron/modules/template-match.js +204 -0
- package/dist/headless/electron/modules/undo-stack.js +40 -0
- package/dist/headless/electron/modules/watchers/active-window-watcher.js +151 -0
- package/dist/headless/electron/modules/watchers/clipboard-watcher.js +89 -0
- package/dist/headless/electron/modules/watchers/file-watcher.js +90 -0
- package/dist/headless/electron/modules/watchers/registry.js +107 -0
- package/dist/headless/electron/modules/watchers/screen-region-service.js +125 -0
- package/dist/headless/electron/modules/watchers/screen-region-watcher.js +69 -0
- package/dist/headless/electron/modules/window-activate.js +629 -0
- package/dist/headless/electron/modules/window-input.js +622 -0
- package/dist/headless/electron/modules/window-resolver.js +209 -0
- package/dist/headless/headless/cli.js +66 -8
- package/dist/headless/headless/config-cmd.js +306 -0
- package/dist/headless/headless/doctor.js +599 -0
- package/dist/headless/headless/ollama-cmd.js +211 -0
- package/dist/headless/headless/platform-headless.js +13 -1
- package/dist/headless/headless/server.js +38 -2
- package/dist/headless/headless/stt-cmd.js +213 -0
- package/dist/headless/headless/tui/index.mjs +7 -0
- package/dist/headless/headless/tui/plain-dump.js +41 -0
- package/dist/headless/headless/tui/settings-app.mjs +744 -0
- package/dist/headless/headless/tui/setup-wizard.mjs +257 -0
- package/dist/headless/headless/tui-bridge.js +80 -0
- package/dist/headless/shared/constants.js +3 -1
- package/dist/shared/constants.d.ts +2 -0
- package/dist/shared/constants.d.ts.map +1 -1
- package/dist/shared/constants.js +3 -1
- package/dist/shared/constants.js.map +1 -1
- package/dist/shared/types.d.ts +8 -0
- package/dist/shared/types.d.ts.map +1 -1
- package/mcp-server/dist/api-client.js +257 -6
- package/mcp-server/dist/index.js +1566 -46
- package/mcp-server/dist/project-sense.js +161 -0
- package/mcp-server/dist/tool-categories.js +161 -0
- package/mcp-server/package.json +8 -2
- package/package.json +33 -5
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fast similarity check between two byte buffers. Samples one byte every 200
|
|
3
|
+
* bytes and returns the ratio of matches (0..1). Used to detect
|
|
4
|
+
* end-of-content (subsequent capture identical to the previous frame) during
|
|
5
|
+
* scroll-capture stitching AND to flag `atEnd` for the agent after a
|
|
6
|
+
* superbased_scroll call.
|
|
7
|
+
*
|
|
8
|
+
* 0.95 is the canonical threshold — matches the auto-scroll-capture stop
|
|
9
|
+
* criterion. Above that: the viewport didn't change (likely hit end of
|
|
10
|
+
* scrollable content). Below: the scroll moved something.
|
|
11
|
+
*
|
|
12
|
+
* Note: PNG-compressed buffers won't be byte-identical for visually identical
|
|
13
|
+
* frames because the zlib stream can differ. quickCompare on raw PNGs is a
|
|
14
|
+
* best-effort signal; pair with a higher threshold (0.95+) to avoid false
|
|
15
|
+
* positives on compression jitter. For precise comparison, decode to raw
|
|
16
|
+
* pixels first.
|
|
17
|
+
*/
|
|
18
|
+
export declare function quickCompare(buf1: Buffer, buf2: Buffer): number;
|
|
19
|
+
/**
|
|
20
|
+
* Default end-of-content threshold for quickCompare on PNG buffers. Shared
|
|
21
|
+
* between scroll-capture.ts and superbased_scroll's atEnd diagnostic.
|
|
22
|
+
*/
|
|
23
|
+
export declare const END_OF_CONTENT_SIMILARITY = 0.95;
|
|
24
|
+
/**
|
|
25
|
+
* Approximate stddev of a raw RGB(A) strip via every-Nth-byte sampling.
|
|
26
|
+
* Used to reject "solid color" strips from multi-strip correlation —
|
|
27
|
+
* a strip with no visual features will score 1.0 at offset=0 (pre == post
|
|
28
|
+
* == same-color) and falsely report "no movement" even when the rest of
|
|
29
|
+
* the window scrolled.
|
|
30
|
+
*
|
|
31
|
+
* Returns stddev on a 0..255 scale. Thresholds:
|
|
32
|
+
* - < 6 — effectively solid color (background column). Reject.
|
|
33
|
+
* - 6..12 — low texture (gradient, translucent panel). Risky; caller can decide.
|
|
34
|
+
* - > 12 — real content (text, icons, colored UI). Trust the correlation.
|
|
35
|
+
*/
|
|
36
|
+
export declare function stripVariance(strip: Buffer, sampleStride?: number): number;
|
|
37
|
+
/**
|
|
38
|
+
* Minimum stddev for a strip to be accepted into multi-strip correlation.
|
|
39
|
+
* Tuned against the user's round-3 trace where a solid-background strip
|
|
40
|
+
* pinned offset=0 and produced a false atEnd=true signal even though the
|
|
41
|
+
* textured strips had clear vertical movement.
|
|
42
|
+
*/
|
|
43
|
+
export declare const MIN_STRIP_VARIANCE = 8;
|
|
44
|
+
/**
|
|
45
|
+
* Pixel-correlation offset measurement: given raw RGB strips from a pre-scroll
|
|
46
|
+
* and post-scroll capture, find the vertical offset that best aligns them.
|
|
47
|
+
* Returns { offsetPx, score } — offsetPx is the number of pixels the content
|
|
48
|
+
* moved upward, score is the correlation confidence (0..1).
|
|
49
|
+
*
|
|
50
|
+
* Search range: offset ∈ [minOffset, maxSearch]. minOffset defaults to 0 so
|
|
51
|
+
* "no movement" (offset=0) can be detected as a high-score match — used by
|
|
52
|
+
* superbased_scroll's atEnd signal (if offset=0 scores high, the viewport
|
|
53
|
+
* didn't move = end of content). For calibration, the caller should set
|
|
54
|
+
* minOffset >= 10 to reject accidental high scores from static areas.
|
|
55
|
+
*
|
|
56
|
+
* Used by:
|
|
57
|
+
* - scroll-capture.ts calibrateScroll() — measures pixels-per-tick for
|
|
58
|
+
* the long-page stitched-screenshot flow.
|
|
59
|
+
* - gui-automation.ts calibratePixelsPerScroll() — same, for MCP
|
|
60
|
+
* superbased_scroll unit='page'.
|
|
61
|
+
* - gui-automation.ts scroll() atEnd detection — checks offset=0 match.
|
|
62
|
+
*
|
|
63
|
+
* stripHeight: rows in both strips (must match).
|
|
64
|
+
* stripWidth: columns in both strips (must match).
|
|
65
|
+
* channels: bytes per pixel (3 = RGB, 4 = RGBA).
|
|
66
|
+
* minOffset: smallest offset to test (default 0 — include no-movement case).
|
|
67
|
+
* maxSearchFraction: cap offset at this fraction of stripHeight (default 0.6).
|
|
68
|
+
* maxSearchCap: absolute pixel cap on the search range (default 500).
|
|
69
|
+
* The search range is `min(stripHeight × fraction, cap)`. Raise the cap
|
|
70
|
+
* for contexts that can legitimately see large scrolls (e.g. a
|
|
71
|
+
* 5-tick calibration scroll on Chrome 150% DPI with default wheel
|
|
72
|
+
* settings can move 750+ px; at the 500 default the measurement is
|
|
73
|
+
* truncated and reports a smaller-than-actual offset). Perf cost
|
|
74
|
+
* scales linearly with the cap.
|
|
75
|
+
* stickyRowMask: optional boolean[] of length stripHeight. Rows flagged
|
|
76
|
+
* `true` are skipped from scoring at every offset. Used to remove the
|
|
77
|
+
* contribution of fixed-position UI chrome (URL bar, cookie banners,
|
|
78
|
+
* floating overlays) from the correlation — without masking, static
|
|
79
|
+
* rows inflate offset=0's score because they byte-match at offset=0
|
|
80
|
+
* regardless of how much the rest of the strip scrolled.
|
|
81
|
+
*/
|
|
82
|
+
export declare function measurePixelOffset(strip1: Buffer, strip2: Buffer, opts: {
|
|
83
|
+
stripWidth: number;
|
|
84
|
+
stripHeight: number;
|
|
85
|
+
channels: number;
|
|
86
|
+
minOffset?: number;
|
|
87
|
+
maxSearchFraction?: number;
|
|
88
|
+
maxSearchCap?: number;
|
|
89
|
+
stickyRowMask?: boolean[];
|
|
90
|
+
}): {
|
|
91
|
+
offsetPx: number;
|
|
92
|
+
score: number;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Build a per-row "sticky" mask from a strip pair. A row is flagged
|
|
96
|
+
* sticky when every byte at row index R is identical between strip1
|
|
97
|
+
* (pre-scroll) and strip2 (post-scroll) — i.e. the content at Y=R
|
|
98
|
+
* didn't move with the scroll. Typical examples: URL/tab bar, cookie
|
|
99
|
+
* banners, floating modals, footer widgets.
|
|
100
|
+
*
|
|
101
|
+
* Operates on raw pixel buffers (no compression jitter), so strict
|
|
102
|
+
* byte equality is the correct test. Fast: short-circuits on the first
|
|
103
|
+
* byte difference per row.
|
|
104
|
+
*
|
|
105
|
+
* Pass the returned mask to measurePixelOffset to exclude sticky rows
|
|
106
|
+
* from correlation scoring.
|
|
107
|
+
*/
|
|
108
|
+
export declare function buildStickyRowMask(strip1: Buffer, strip2: Buffer, stripWidth: number, stripHeight: number, channels: number): boolean[];
|
|
109
|
+
/**
|
|
110
|
+
* Scroll the window under the cursor via Win32 mouse_event. Each WHEEL_DELTA
|
|
111
|
+
* (120) = one "wheel click" — typically 3 text lines in most apps. Positive
|
|
112
|
+
* ticks = scroll DOWN, negative = scroll UP (matches nut-js conventions;
|
|
113
|
+
* we negate internally because Win32 signs WHEEL_DELTA upward).
|
|
114
|
+
*
|
|
115
|
+
* Why prefer this over nut-js: nut-js sends synthetic wheel events via
|
|
116
|
+
* SendInput. Many Electron / Chromium / React scroll containers have
|
|
117
|
+
* handlers that check `WheelEvent.isTrusted` or ignore synthetic events
|
|
118
|
+
* entirely, so the scroll no-ops silently. Win32 mouse_event bypasses
|
|
119
|
+
* SendInput and writes directly to the input queue — scrolls land.
|
|
120
|
+
*
|
|
121
|
+
* Shells out to PowerShell. ~100-200ms cold-start overhead per call. One
|
|
122
|
+
* call can scroll many ticks at once (Windows handles multi-tick wheel
|
|
123
|
+
* deltas natively), so batch when possible.
|
|
124
|
+
*/
|
|
125
|
+
export declare function win32Scroll(ticks: number): boolean;
|
|
126
|
+
/**
|
|
127
|
+
* 2.5 — horizontal wheel via MOUSEEVENTF_HWHEEL (0x01000). Distinct from
|
|
128
|
+
* Shift+Wheel — apps like Excel / Chromium distinguish real HWheel from
|
|
129
|
+
* modified vertical wheel, and only the real HWheel path routes through
|
|
130
|
+
* the horizontal scroll bar consistently. Positive ticks = scroll RIGHT,
|
|
131
|
+
* negative = scroll LEFT (Windows signs HWHEEL_DELTA rightward; we keep
|
|
132
|
+
* the same convention as win32Scroll's down-positive to match our API).
|
|
133
|
+
*
|
|
134
|
+
* Same shell-out + cost profile as win32Scroll (~100-200ms cold-start).
|
|
135
|
+
*/
|
|
136
|
+
export declare function win32HScroll(ticks: number): boolean;
|
|
137
|
+
/**
|
|
138
|
+
* Default overlap fraction used by both scroll-capture's stitched flow AND
|
|
139
|
+
* superbased_scroll's unit='page' calculation. 10% overlap gives the
|
|
140
|
+
* redundancy the stitch needs while keeping per-page movement predictable.
|
|
141
|
+
*/
|
|
142
|
+
export declare const PAGE_SCROLL_OVERLAP = 0.1;
|
|
143
|
+
/**
|
|
144
|
+
* Result of a calibration measurement.
|
|
145
|
+
*/
|
|
146
|
+
export interface CalibrationResult {
|
|
147
|
+
pixelsPerScroll: number;
|
|
148
|
+
score: number;
|
|
149
|
+
offsetPx: number;
|
|
150
|
+
ticksUsed: number;
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=scroll-calibration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scroll-calibration.d.ts","sourceRoot":"","sources":["../../../electron/modules/scroll-calibration.ts"],"names":[],"mappings":"AAcA;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAW/D;AAED;;;GAGG;AACH,eAAO,MAAM,yBAAyB,OAAO,CAAC;AAE9C;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,SAAK,GAAG,MAAM,CAetE;AAED;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,IAAI,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,IAAI,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,OAAO,EAAE,CAAA;CAAE,GACpK;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CA4CrC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,GACf,OAAO,EAAE,CAeX;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAYlD;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAYnD;AAED;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,MAAO,CAAC;AAExC;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Shared calibration helpers for scrolling — extracted from scroll-capture.ts
|
|
3
|
+
// so both the auto-scroll-capture flow (long-page stitched screenshots) and
|
|
4
|
+
// superbased_scroll (agent-driven single-call scroll with atEnd signal) can
|
|
5
|
+
// share the pixel-correlation math, the duplicate-frame check, AND the
|
|
6
|
+
// Win32 wheel-event scroll (nut-js synthetic wheel events are dropped by
|
|
7
|
+
// many Electron / React scroll containers; real Win32 mouse_event is not).
|
|
8
|
+
//
|
|
9
|
+
// The pure math helpers (quickCompare, measurePixelOffset, constants) are
|
|
10
|
+
// reusable from any context. win32Scroll shells out to PowerShell and is
|
|
11
|
+
// Windows-only.
|
|
12
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
|
+
};
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.PAGE_SCROLL_OVERLAP = exports.MIN_STRIP_VARIANCE = exports.END_OF_CONTENT_SIMILARITY = void 0;
|
|
17
|
+
exports.quickCompare = quickCompare;
|
|
18
|
+
exports.stripVariance = stripVariance;
|
|
19
|
+
exports.measurePixelOffset = measurePixelOffset;
|
|
20
|
+
exports.buildStickyRowMask = buildStickyRowMask;
|
|
21
|
+
exports.win32Scroll = win32Scroll;
|
|
22
|
+
exports.win32HScroll = win32HScroll;
|
|
23
|
+
const child_process_1 = require("child_process");
|
|
24
|
+
const logger_1 = __importDefault(require("../logger"));
|
|
25
|
+
/**
|
|
26
|
+
* Fast similarity check between two byte buffers. Samples one byte every 200
|
|
27
|
+
* bytes and returns the ratio of matches (0..1). Used to detect
|
|
28
|
+
* end-of-content (subsequent capture identical to the previous frame) during
|
|
29
|
+
* scroll-capture stitching AND to flag `atEnd` for the agent after a
|
|
30
|
+
* superbased_scroll call.
|
|
31
|
+
*
|
|
32
|
+
* 0.95 is the canonical threshold — matches the auto-scroll-capture stop
|
|
33
|
+
* criterion. Above that: the viewport didn't change (likely hit end of
|
|
34
|
+
* scrollable content). Below: the scroll moved something.
|
|
35
|
+
*
|
|
36
|
+
* Note: PNG-compressed buffers won't be byte-identical for visually identical
|
|
37
|
+
* frames because the zlib stream can differ. quickCompare on raw PNGs is a
|
|
38
|
+
* best-effort signal; pair with a higher threshold (0.95+) to avoid false
|
|
39
|
+
* positives on compression jitter. For precise comparison, decode to raw
|
|
40
|
+
* pixels first.
|
|
41
|
+
*/
|
|
42
|
+
function quickCompare(buf1, buf2) {
|
|
43
|
+
if (buf1.equals(buf2))
|
|
44
|
+
return 1.0;
|
|
45
|
+
const step = 200;
|
|
46
|
+
const len = Math.min(buf1.length, buf2.length);
|
|
47
|
+
let matches = 0;
|
|
48
|
+
let samples = 0;
|
|
49
|
+
for (let i = 0; i < len; i += step) {
|
|
50
|
+
samples++;
|
|
51
|
+
if (buf1[i] === buf2[i])
|
|
52
|
+
matches++;
|
|
53
|
+
}
|
|
54
|
+
return samples > 0 ? matches / samples : 0;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Default end-of-content threshold for quickCompare on PNG buffers. Shared
|
|
58
|
+
* between scroll-capture.ts and superbased_scroll's atEnd diagnostic.
|
|
59
|
+
*/
|
|
60
|
+
exports.END_OF_CONTENT_SIMILARITY = 0.95;
|
|
61
|
+
/**
|
|
62
|
+
* Approximate stddev of a raw RGB(A) strip via every-Nth-byte sampling.
|
|
63
|
+
* Used to reject "solid color" strips from multi-strip correlation —
|
|
64
|
+
* a strip with no visual features will score 1.0 at offset=0 (pre == post
|
|
65
|
+
* == same-color) and falsely report "no movement" even when the rest of
|
|
66
|
+
* the window scrolled.
|
|
67
|
+
*
|
|
68
|
+
* Returns stddev on a 0..255 scale. Thresholds:
|
|
69
|
+
* - < 6 — effectively solid color (background column). Reject.
|
|
70
|
+
* - 6..12 — low texture (gradient, translucent panel). Risky; caller can decide.
|
|
71
|
+
* - > 12 — real content (text, icons, colored UI). Trust the correlation.
|
|
72
|
+
*/
|
|
73
|
+
function stripVariance(strip, sampleStride = 20) {
|
|
74
|
+
let n = 0;
|
|
75
|
+
let sum = 0;
|
|
76
|
+
let sumSq = 0;
|
|
77
|
+
for (let i = 0; i < strip.length; i += sampleStride) {
|
|
78
|
+
const v = strip[i];
|
|
79
|
+
if (v === undefined)
|
|
80
|
+
continue;
|
|
81
|
+
sum += v;
|
|
82
|
+
sumSq += v * v;
|
|
83
|
+
n++;
|
|
84
|
+
}
|
|
85
|
+
if (n === 0)
|
|
86
|
+
return 0;
|
|
87
|
+
const mean = sum / n;
|
|
88
|
+
const variance = (sumSq / n) - (mean * mean);
|
|
89
|
+
return Math.sqrt(Math.max(0, variance));
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Minimum stddev for a strip to be accepted into multi-strip correlation.
|
|
93
|
+
* Tuned against the user's round-3 trace where a solid-background strip
|
|
94
|
+
* pinned offset=0 and produced a false atEnd=true signal even though the
|
|
95
|
+
* textured strips had clear vertical movement.
|
|
96
|
+
*/
|
|
97
|
+
exports.MIN_STRIP_VARIANCE = 8;
|
|
98
|
+
/**
|
|
99
|
+
* Pixel-correlation offset measurement: given raw RGB strips from a pre-scroll
|
|
100
|
+
* and post-scroll capture, find the vertical offset that best aligns them.
|
|
101
|
+
* Returns { offsetPx, score } — offsetPx is the number of pixels the content
|
|
102
|
+
* moved upward, score is the correlation confidence (0..1).
|
|
103
|
+
*
|
|
104
|
+
* Search range: offset ∈ [minOffset, maxSearch]. minOffset defaults to 0 so
|
|
105
|
+
* "no movement" (offset=0) can be detected as a high-score match — used by
|
|
106
|
+
* superbased_scroll's atEnd signal (if offset=0 scores high, the viewport
|
|
107
|
+
* didn't move = end of content). For calibration, the caller should set
|
|
108
|
+
* minOffset >= 10 to reject accidental high scores from static areas.
|
|
109
|
+
*
|
|
110
|
+
* Used by:
|
|
111
|
+
* - scroll-capture.ts calibrateScroll() — measures pixels-per-tick for
|
|
112
|
+
* the long-page stitched-screenshot flow.
|
|
113
|
+
* - gui-automation.ts calibratePixelsPerScroll() — same, for MCP
|
|
114
|
+
* superbased_scroll unit='page'.
|
|
115
|
+
* - gui-automation.ts scroll() atEnd detection — checks offset=0 match.
|
|
116
|
+
*
|
|
117
|
+
* stripHeight: rows in both strips (must match).
|
|
118
|
+
* stripWidth: columns in both strips (must match).
|
|
119
|
+
* channels: bytes per pixel (3 = RGB, 4 = RGBA).
|
|
120
|
+
* minOffset: smallest offset to test (default 0 — include no-movement case).
|
|
121
|
+
* maxSearchFraction: cap offset at this fraction of stripHeight (default 0.6).
|
|
122
|
+
* maxSearchCap: absolute pixel cap on the search range (default 500).
|
|
123
|
+
* The search range is `min(stripHeight × fraction, cap)`. Raise the cap
|
|
124
|
+
* for contexts that can legitimately see large scrolls (e.g. a
|
|
125
|
+
* 5-tick calibration scroll on Chrome 150% DPI with default wheel
|
|
126
|
+
* settings can move 750+ px; at the 500 default the measurement is
|
|
127
|
+
* truncated and reports a smaller-than-actual offset). Perf cost
|
|
128
|
+
* scales linearly with the cap.
|
|
129
|
+
* stickyRowMask: optional boolean[] of length stripHeight. Rows flagged
|
|
130
|
+
* `true` are skipped from scoring at every offset. Used to remove the
|
|
131
|
+
* contribution of fixed-position UI chrome (URL bar, cookie banners,
|
|
132
|
+
* floating overlays) from the correlation — without masking, static
|
|
133
|
+
* rows inflate offset=0's score because they byte-match at offset=0
|
|
134
|
+
* regardless of how much the rest of the strip scrolled.
|
|
135
|
+
*/
|
|
136
|
+
function measurePixelOffset(strip1, strip2, opts) {
|
|
137
|
+
const { stripWidth, stripHeight, channels } = opts;
|
|
138
|
+
const rowBytes = stripWidth * channels;
|
|
139
|
+
const minOffset = Math.max(0, opts.minOffset ?? 0);
|
|
140
|
+
const maxSearch = Math.min(Math.round(stripHeight * (opts.maxSearchFraction ?? 0.6)), opts.maxSearchCap ?? 500);
|
|
141
|
+
const stickyRowMask = opts.stickyRowMask;
|
|
142
|
+
let bestOffset = minOffset;
|
|
143
|
+
let bestScore = 0;
|
|
144
|
+
for (let offset = minOffset; offset <= maxSearch; offset++) {
|
|
145
|
+
const compareRows = stripHeight - offset;
|
|
146
|
+
if (compareRows < 30)
|
|
147
|
+
break;
|
|
148
|
+
let matchSum = 0;
|
|
149
|
+
let totalSamples = 0;
|
|
150
|
+
for (let row = 0; row < compareRows; row += 2) {
|
|
151
|
+
// Skip rows known to be sticky (fixed-position chrome / overlays).
|
|
152
|
+
// Without this, sticky rows would contribute perfect matches at
|
|
153
|
+
// offset=0 and zero matches at offset>0, artificially biasing the
|
|
154
|
+
// score toward offset=0.
|
|
155
|
+
if (stickyRowMask && stickyRowMask[row])
|
|
156
|
+
continue;
|
|
157
|
+
const idx1Start = (row + offset) * rowBytes;
|
|
158
|
+
const idx2Start = row * rowBytes;
|
|
159
|
+
for (let b = 0; b < rowBytes; b += 3) {
|
|
160
|
+
const v1 = strip1[idx1Start + b];
|
|
161
|
+
const v2 = strip2[idx2Start + b];
|
|
162
|
+
if (v1 !== undefined && v2 !== undefined) {
|
|
163
|
+
totalSamples++;
|
|
164
|
+
if (Math.abs(v1 - v2) < 15)
|
|
165
|
+
matchSum++;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
const score = totalSamples > 0 ? matchSum / totalSamples : 0;
|
|
170
|
+
if (score > bestScore) {
|
|
171
|
+
bestScore = score;
|
|
172
|
+
bestOffset = offset;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return { offsetPx: bestOffset, score: bestScore };
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Build a per-row "sticky" mask from a strip pair. A row is flagged
|
|
179
|
+
* sticky when every byte at row index R is identical between strip1
|
|
180
|
+
* (pre-scroll) and strip2 (post-scroll) — i.e. the content at Y=R
|
|
181
|
+
* didn't move with the scroll. Typical examples: URL/tab bar, cookie
|
|
182
|
+
* banners, floating modals, footer widgets.
|
|
183
|
+
*
|
|
184
|
+
* Operates on raw pixel buffers (no compression jitter), so strict
|
|
185
|
+
* byte equality is the correct test. Fast: short-circuits on the first
|
|
186
|
+
* byte difference per row.
|
|
187
|
+
*
|
|
188
|
+
* Pass the returned mask to measurePixelOffset to exclude sticky rows
|
|
189
|
+
* from correlation scoring.
|
|
190
|
+
*/
|
|
191
|
+
function buildStickyRowMask(strip1, strip2, stripWidth, stripHeight, channels) {
|
|
192
|
+
const rowBytes = stripWidth * channels;
|
|
193
|
+
const mask = new Array(stripHeight);
|
|
194
|
+
for (let row = 0; row < stripHeight; row++) {
|
|
195
|
+
const start = row * rowBytes;
|
|
196
|
+
let identical = true;
|
|
197
|
+
for (let i = 0; i < rowBytes; i++) {
|
|
198
|
+
if (strip1[start + i] !== strip2[start + i]) {
|
|
199
|
+
identical = false;
|
|
200
|
+
break;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
mask[row] = identical;
|
|
204
|
+
}
|
|
205
|
+
return mask;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Scroll the window under the cursor via Win32 mouse_event. Each WHEEL_DELTA
|
|
209
|
+
* (120) = one "wheel click" — typically 3 text lines in most apps. Positive
|
|
210
|
+
* ticks = scroll DOWN, negative = scroll UP (matches nut-js conventions;
|
|
211
|
+
* we negate internally because Win32 signs WHEEL_DELTA upward).
|
|
212
|
+
*
|
|
213
|
+
* Why prefer this over nut-js: nut-js sends synthetic wheel events via
|
|
214
|
+
* SendInput. Many Electron / Chromium / React scroll containers have
|
|
215
|
+
* handlers that check `WheelEvent.isTrusted` or ignore synthetic events
|
|
216
|
+
* entirely, so the scroll no-ops silently. Win32 mouse_event bypasses
|
|
217
|
+
* SendInput and writes directly to the input queue — scrolls land.
|
|
218
|
+
*
|
|
219
|
+
* Shells out to PowerShell. ~100-200ms cold-start overhead per call. One
|
|
220
|
+
* call can scroll many ticks at once (Windows handles multi-tick wheel
|
|
221
|
+
* deltas natively), so batch when possible.
|
|
222
|
+
*/
|
|
223
|
+
function win32Scroll(ticks) {
|
|
224
|
+
if (process.platform !== 'win32')
|
|
225
|
+
return false;
|
|
226
|
+
if (!Number.isFinite(ticks) || ticks === 0)
|
|
227
|
+
return false;
|
|
228
|
+
const delta = -Math.round(ticks) * 120;
|
|
229
|
+
const cmd = `powershell -NoProfile -Command "Add-Type -TypeDefinition 'using System;using System.Runtime.InteropServices;public class M{[DllImport(\\\"user32.dll\\\")]public static extern void mouse_event(uint f,int x,int y,int d,int e);public const uint W=0x0800;}';[M]::mouse_event([M]::W,0,0,${delta},0)"`;
|
|
230
|
+
try {
|
|
231
|
+
(0, child_process_1.execSync)(cmd, { windowsHide: true, timeout: 3000, stdio: 'pipe' });
|
|
232
|
+
return true;
|
|
233
|
+
}
|
|
234
|
+
catch (err) {
|
|
235
|
+
logger_1.default.warn('[scroll-calibration] win32Scroll failed:', err);
|
|
236
|
+
return false;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* 2.5 — horizontal wheel via MOUSEEVENTF_HWHEEL (0x01000). Distinct from
|
|
241
|
+
* Shift+Wheel — apps like Excel / Chromium distinguish real HWheel from
|
|
242
|
+
* modified vertical wheel, and only the real HWheel path routes through
|
|
243
|
+
* the horizontal scroll bar consistently. Positive ticks = scroll RIGHT,
|
|
244
|
+
* negative = scroll LEFT (Windows signs HWHEEL_DELTA rightward; we keep
|
|
245
|
+
* the same convention as win32Scroll's down-positive to match our API).
|
|
246
|
+
*
|
|
247
|
+
* Same shell-out + cost profile as win32Scroll (~100-200ms cold-start).
|
|
248
|
+
*/
|
|
249
|
+
function win32HScroll(ticks) {
|
|
250
|
+
if (process.platform !== 'win32')
|
|
251
|
+
return false;
|
|
252
|
+
if (!Number.isFinite(ticks) || ticks === 0)
|
|
253
|
+
return false;
|
|
254
|
+
const delta = Math.round(ticks) * 120;
|
|
255
|
+
const cmd = `powershell -NoProfile -Command "Add-Type -TypeDefinition 'using System;using System.Runtime.InteropServices;public class M{[DllImport(\\\"user32.dll\\\")]public static extern void mouse_event(uint f,int x,int y,int d,int e);public const uint H=0x01000;}';[M]::mouse_event([M]::H,0,0,${delta},0)"`;
|
|
256
|
+
try {
|
|
257
|
+
(0, child_process_1.execSync)(cmd, { windowsHide: true, timeout: 3000, stdio: 'pipe' });
|
|
258
|
+
return true;
|
|
259
|
+
}
|
|
260
|
+
catch (err) {
|
|
261
|
+
logger_1.default.warn('[scroll-calibration] win32HScroll failed:', err);
|
|
262
|
+
return false;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Default overlap fraction used by both scroll-capture's stitched flow AND
|
|
267
|
+
* superbased_scroll's unit='page' calculation. 10% overlap gives the
|
|
268
|
+
* redundancy the stitch needs while keeping per-page movement predictable.
|
|
269
|
+
*/
|
|
270
|
+
exports.PAGE_SCROLL_OVERLAP = 0.10;
|
|
271
|
+
//# sourceMappingURL=scroll-calibration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{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CaptureOptions {
|
|
|
8
8
|
onProgress: (index: number, total: number) => void;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
|
-
* Calibrate: measure how many pixels one scroll tick moves.
|
|
11
|
+
* Calibrate: measure how many pixels one scroll tick moves. Shared pixel-
|
|
12
|
+
* correlation math lives in scroll-calibration.ts — this function wraps it
|
|
13
|
+
* with the focus-and-scroll I/O dance specific to auto-scroll-capture.
|
|
12
14
|
*/
|
|
13
15
|
export declare function calibrateScroll(region: CaptureRegion): Promise<number>;
|
|
14
16
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scroll-capture.d.ts","sourceRoot":"","sources":["../../../electron/modules/scroll-capture.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAInD,UAAU,oBAAoB;IAC5B,MAAM,EAAE,aAAa,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACpD;
|
|
1
|
+
{"version":3,"file":"scroll-capture.d.ts","sourceRoot":"","sources":["../../../electron/modules/scroll-capture.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAInD,UAAU,oBAAoB;IAC5B,MAAM,EAAE,aAAa,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACpD;AAgBD;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAgE5E;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CA8D3F"}
|
|
@@ -10,26 +10,10 @@ const electron_1 = require("electron");
|
|
|
10
10
|
const logger_1 = __importDefault(require("../logger"));
|
|
11
11
|
const nut_js_1 = require("@nut-tree-fork/nut-js");
|
|
12
12
|
const capture_1 = require("./capture");
|
|
13
|
-
const
|
|
13
|
+
const scroll_calibration_1 = require("./scroll-calibration");
|
|
14
14
|
async function delay(ms) {
|
|
15
15
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
16
16
|
}
|
|
17
|
-
/**
|
|
18
|
-
* Scroll down using Win32 mouse_event API via PowerShell.
|
|
19
|
-
* Each call sends one WHEEL_DELTA (120 units = ~3 lines in most apps).
|
|
20
|
-
* ticks: number of wheel ticks to scroll (negative = down)
|
|
21
|
-
*/
|
|
22
|
-
function win32Scroll(ticks) {
|
|
23
|
-
// WHEEL_DELTA is 120. Negative = scroll down, positive = scroll up.
|
|
24
|
-
const delta = -ticks * 120;
|
|
25
|
-
const cmd = `powershell -NoProfile -Command "Add-Type -TypeDefinition 'using System;using System.Runtime.InteropServices;public class M{[DllImport(\\\"user32.dll\\\")]public static extern void mouse_event(uint f,int x,int y,int d,int e);public const uint W=0x0800;}';[M]::mouse_event([M]::W,0,0,${delta},0)"`;
|
|
26
|
-
try {
|
|
27
|
-
(0, child_process_1.execSync)(cmd, { windowsHide: true, timeout: 3000, stdio: 'pipe' });
|
|
28
|
-
}
|
|
29
|
-
catch (e) {
|
|
30
|
-
logger_1.default.error('[Scroll] Win32 scroll failed:', e);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
17
|
/**
|
|
34
18
|
* Click at position to ensure the window under cursor has focus.
|
|
35
19
|
*/
|
|
@@ -40,24 +24,9 @@ async function clickToFocus(x, y) {
|
|
|
40
24
|
await delay(200);
|
|
41
25
|
}
|
|
42
26
|
/**
|
|
43
|
-
*
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if (buf1.equals(buf2))
|
|
47
|
-
return 1.0;
|
|
48
|
-
const step = 200;
|
|
49
|
-
const len = Math.min(buf1.length, buf2.length);
|
|
50
|
-
let matches = 0;
|
|
51
|
-
let samples = 0;
|
|
52
|
-
for (let i = 0; i < len; i += step) {
|
|
53
|
-
samples++;
|
|
54
|
-
if (buf1[i] === buf2[i])
|
|
55
|
-
matches++;
|
|
56
|
-
}
|
|
57
|
-
return samples > 0 ? matches / samples : 0;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Calibrate: measure how many pixels one scroll tick moves.
|
|
27
|
+
* Calibrate: measure how many pixels one scroll tick moves. Shared pixel-
|
|
28
|
+
* correlation math lives in scroll-calibration.ts — this function wraps it
|
|
29
|
+
* with the focus-and-scroll I/O dance specific to auto-scroll-capture.
|
|
61
30
|
*/
|
|
62
31
|
async function calibrateScroll(region) {
|
|
63
32
|
const sharp = require('sharp');
|
|
@@ -72,7 +41,7 @@ async function calibrateScroll(region) {
|
|
|
72
41
|
const img1 = await (0, capture_1.cropRegion)(screen1, region);
|
|
73
42
|
// Scroll using Win32 API
|
|
74
43
|
for (let i = 0; i < scrollTicks; i++) {
|
|
75
|
-
win32Scroll(1);
|
|
44
|
+
(0, scroll_calibration_1.win32Scroll)(1);
|
|
76
45
|
await delay(200);
|
|
77
46
|
}
|
|
78
47
|
await delay(400);
|
|
@@ -88,47 +57,27 @@ async function calibrateScroll(region) {
|
|
|
88
57
|
const strip1 = await sharp(img1).extract({ left: stripX, top: 0, width: stripW, height: h }).raw().toBuffer();
|
|
89
58
|
const strip2 = await sharp(img2).extract({ left: stripX, top: 0, width: stripW, height: h }).raw().toBuffer();
|
|
90
59
|
const channels = Math.round(strip1.length / (stripW * h));
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
for (let row = 0; row < compareRows; row += 2) {
|
|
102
|
-
const idx1Start = (row + offset) * rowBytes;
|
|
103
|
-
const idx2Start = row * rowBytes;
|
|
104
|
-
for (let b = 0; b < rowBytes; b += 3) {
|
|
105
|
-
const v1 = strip1[idx1Start + b];
|
|
106
|
-
const v2 = strip2[idx2Start + b];
|
|
107
|
-
if (v1 !== undefined && v2 !== undefined) {
|
|
108
|
-
totalSamples++;
|
|
109
|
-
if (Math.abs(v1 - v2) < 15)
|
|
110
|
-
matchSum++;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
const score = totalSamples > 0 ? matchSum / totalSamples : 0;
|
|
115
|
-
if (score > bestScore) {
|
|
116
|
-
bestScore = score;
|
|
117
|
-
bestOffset = offset;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
logger_1.default.info(`[Calibrate] Total offset for ${scrollTicks} ticks: ${bestOffset}px (score: ${bestScore.toFixed(3)})`);
|
|
60
|
+
const { offsetPx, score } = (0, scroll_calibration_1.measurePixelOffset)(strip1, strip2, {
|
|
61
|
+
stripWidth: stripW,
|
|
62
|
+
stripHeight: h,
|
|
63
|
+
channels,
|
|
64
|
+
// Preserve pre-C8 behavior — calibration requires real movement ≥ 10px,
|
|
65
|
+
// so no need to test offset=0..9. Stops accidental high-score matches
|
|
66
|
+
// on near-static windows from being confused with successful calibration.
|
|
67
|
+
minOffset: 10,
|
|
68
|
+
});
|
|
69
|
+
logger_1.default.info(`[Calibrate] Total offset for ${scrollTicks} ticks: ${offsetPx}px (score: ${score.toFixed(3)})`);
|
|
121
70
|
// Scroll back up
|
|
122
71
|
for (let i = 0; i < scrollTicks; i++) {
|
|
123
|
-
win32Scroll(-1);
|
|
72
|
+
(0, scroll_calibration_1.win32Scroll)(-1);
|
|
124
73
|
await delay(100);
|
|
125
74
|
}
|
|
126
75
|
await delay(200);
|
|
127
|
-
if (
|
|
76
|
+
if (score < 0.6 || offsetPx < 15) {
|
|
128
77
|
logger_1.default.info('[Calibrate] Low confidence');
|
|
129
78
|
return 0;
|
|
130
79
|
}
|
|
131
|
-
const perScroll = Math.round(
|
|
80
|
+
const perScroll = Math.round(offsetPx / scrollTicks);
|
|
132
81
|
logger_1.default.info(`[Calibrate] Per tick: ${perScroll}px`);
|
|
133
82
|
return perScroll;
|
|
134
83
|
}
|
|
@@ -161,7 +110,7 @@ async function performScrollCapture(options) {
|
|
|
161
110
|
for (let i = 1; i < maxScreenshots; i++) {
|
|
162
111
|
// Scroll using Win32 API
|
|
163
112
|
for (let t = 0; t < scrollTicks; t++) {
|
|
164
|
-
win32Scroll(1);
|
|
113
|
+
(0, scroll_calibration_1.win32Scroll)(1);
|
|
165
114
|
if (t < scrollTicks - 1)
|
|
166
115
|
await delay(50);
|
|
167
116
|
}
|
|
@@ -169,9 +118,9 @@ async function performScrollCapture(options) {
|
|
|
169
118
|
// Capture
|
|
170
119
|
fullScreen = await (0, capture_1.captureScreen)();
|
|
171
120
|
currentCapture = await (0, capture_1.cropRegion)(fullScreen, region);
|
|
172
|
-
const similarity = quickCompare(previousCapture, currentCapture);
|
|
121
|
+
const similarity = (0, scroll_calibration_1.quickCompare)(previousCapture, currentCapture);
|
|
173
122
|
logger_1.default.info(`[ScrollCapture] Frame ${i + 1}/${maxScreenshots}: similarity=${similarity.toFixed(3)}`);
|
|
174
|
-
if (similarity >
|
|
123
|
+
if (similarity > scroll_calibration_1.END_OF_CONTENT_SIMILARITY) {
|
|
175
124
|
logger_1.default.info(`[ScrollCapture] End of content at frame ${i + 1}`);
|
|
176
125
|
break;
|
|
177
126
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scroll-capture.js","sourceRoot":"","sources":["../../../electron/modules/scroll-capture.ts"],"names":[],"mappings":";AAAA,mEAAmE;;;;;
|
|
1
|
+
{"version":3,"file":"scroll-capture.js","sourceRoot":"","sources":["../../../electron/modules/scroll-capture.ts"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