superbased 1.6.3 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +169 -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 +1414 -218
- 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 +1414 -218
- 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 +60 -7
- 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 +1660 -61
- 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,421 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Windows input adapter — thin wrapper over nut-js for the existing primitives.
|
|
3
|
+
// Phase 0.16 filled in `typeUnicode`. Phase 1.1 folds the PostMessage / SendInput
|
|
4
|
+
// classifier into `sendHotkey`. Phase 1.3 fills in `drag` with the full primitive
|
|
5
|
+
// path (press/interp/release). Phase 2.2 fills in `hover`.
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
+
}) : function(o, v) {
|
|
20
|
+
o["default"] = v;
|
|
21
|
+
});
|
|
22
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
23
|
+
var ownKeys = function(o) {
|
|
24
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
25
|
+
var ar = [];
|
|
26
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
27
|
+
return ar;
|
|
28
|
+
};
|
|
29
|
+
return ownKeys(o);
|
|
30
|
+
};
|
|
31
|
+
return function (mod) {
|
|
32
|
+
if (mod && mod.__esModule) return mod;
|
|
33
|
+
var result = {};
|
|
34
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
35
|
+
__setModuleDefault(result, mod);
|
|
36
|
+
return result;
|
|
37
|
+
};
|
|
38
|
+
})();
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.WindowsInputAdapter = void 0;
|
|
41
|
+
exports.shouldForceSendInput = shouldForceSendInput;
|
|
42
|
+
const errors_1 = require("../errors");
|
|
43
|
+
const shared_1 = require("../shared");
|
|
44
|
+
let nutJs = null;
|
|
45
|
+
function getNut() {
|
|
46
|
+
if (nutJs)
|
|
47
|
+
return nutJs;
|
|
48
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
49
|
+
nutJs = require('@nut-tree-fork/nut-js');
|
|
50
|
+
nutJs.keyboard.config.autoDelayMs = 5;
|
|
51
|
+
return nutJs;
|
|
52
|
+
}
|
|
53
|
+
function mapModifiers(mods) {
|
|
54
|
+
if (!mods || mods.length === 0)
|
|
55
|
+
return [];
|
|
56
|
+
const nut = getNut();
|
|
57
|
+
return mods.map((m) => {
|
|
58
|
+
switch (m) {
|
|
59
|
+
case 'shift': return nut.Key.LeftShift;
|
|
60
|
+
case 'ctrl': return nut.Key.LeftControl;
|
|
61
|
+
case 'alt': return nut.Key.LeftAlt;
|
|
62
|
+
case 'meta': return nut.Key.LeftSuper;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
// Processes whose message loops silently drop PostMessage(WM_KEYDOWN): browsers
|
|
67
|
+
// route page-level shortcuts through Chromium's IPC, not the HWND queue; Electron
|
|
68
|
+
// apps inherit the same behavior; most modern WPF / UWP shells use DirectComposition
|
|
69
|
+
// + their own input plumbing. For these, PostMessage returns "success" but no key
|
|
70
|
+
// event reaches the renderer — the hotkey effectively no-ops. The classifier forces
|
|
71
|
+
// SendInput + activation so the target receives a real OS-level keystroke.
|
|
72
|
+
//
|
|
73
|
+
// 'notepad' belongs here on Windows 11: Notepad was rewritten as a WinUI 3 app
|
|
74
|
+
// (RichEditD2DPT control) and no longer processes PostMessage WM_KEYDOWN. Classic
|
|
75
|
+
// Windows 10 Notepad (plain Edit control) DID process PostMessage hotkeys, but
|
|
76
|
+
// forcing SendInput on it is still correct — a redundant activation round-trip
|
|
77
|
+
// is cheaper than a silent no-op followed by a confused agent retry.
|
|
78
|
+
const FORCE_SENDINPUT_PROCESSES = new Set([
|
|
79
|
+
'chrome', 'msedge', 'firefox', 'brave', 'opera', 'vivaldi',
|
|
80
|
+
'electron', 'code', 'discord', 'slack', 'notion', 'obsidian',
|
|
81
|
+
'figma', 'spotify', 'superbased', 'notepad',
|
|
82
|
+
]);
|
|
83
|
+
function shouldForceSendInput(processName) {
|
|
84
|
+
if (!processName)
|
|
85
|
+
return false;
|
|
86
|
+
const p = processName.toLowerCase().replace(/\.exe$/, '');
|
|
87
|
+
return FORCE_SENDINPUT_PROCESSES.has(p);
|
|
88
|
+
}
|
|
89
|
+
async function sendInputNutJs(combo) {
|
|
90
|
+
const nut = getNut();
|
|
91
|
+
const parts = combo.split('+').map((p) => p.trim()).filter(Boolean);
|
|
92
|
+
const keys = parts.map(resolveKey);
|
|
93
|
+
await nut.keyboard.pressKey(...keys);
|
|
94
|
+
await nut.keyboard.releaseKey(...keys);
|
|
95
|
+
}
|
|
96
|
+
function resolveKey(name) {
|
|
97
|
+
const nut = getNut();
|
|
98
|
+
const k = name.replace(/[{}]/g, '').trim();
|
|
99
|
+
const lower = k.toLowerCase();
|
|
100
|
+
if (['cmd', 'meta', 'win', 'super'].includes(lower))
|
|
101
|
+
return nut.Key.LeftSuper;
|
|
102
|
+
if (lower === 'ctrl' || lower === 'control')
|
|
103
|
+
return nut.Key.LeftControl;
|
|
104
|
+
if (lower === 'cmdorctrl' || lower === 'commandorcontrol')
|
|
105
|
+
return nut.Key.LeftControl;
|
|
106
|
+
if (lower === 'shift')
|
|
107
|
+
return nut.Key.LeftShift;
|
|
108
|
+
if (lower === 'alt' || lower === 'option')
|
|
109
|
+
return nut.Key.LeftAlt;
|
|
110
|
+
if (lower === 'enter' || lower === 'return')
|
|
111
|
+
return nut.Key.Return;
|
|
112
|
+
if (lower === 'tab')
|
|
113
|
+
return nut.Key.Tab;
|
|
114
|
+
if (lower === 'esc' || lower === 'escape')
|
|
115
|
+
return nut.Key.Escape;
|
|
116
|
+
if (lower === 'space' || lower === 'spacebar')
|
|
117
|
+
return nut.Key.Space;
|
|
118
|
+
if (lower === 'backspace')
|
|
119
|
+
return nut.Key.Backspace;
|
|
120
|
+
if (lower === 'delete' || lower === 'del')
|
|
121
|
+
return nut.Key.Delete;
|
|
122
|
+
if (lower === 'left')
|
|
123
|
+
return nut.Key.Left;
|
|
124
|
+
if (lower === 'right')
|
|
125
|
+
return nut.Key.Right;
|
|
126
|
+
if (lower === 'up')
|
|
127
|
+
return nut.Key.Up;
|
|
128
|
+
if (lower === 'down')
|
|
129
|
+
return nut.Key.Down;
|
|
130
|
+
if (lower === 'home')
|
|
131
|
+
return nut.Key.Home;
|
|
132
|
+
if (lower === 'end')
|
|
133
|
+
return nut.Key.End;
|
|
134
|
+
if (lower === 'pageup' || lower === 'pgup')
|
|
135
|
+
return nut.Key.PageUp;
|
|
136
|
+
if (lower === 'pagedown' || lower === 'pgdn')
|
|
137
|
+
return nut.Key.PageDown;
|
|
138
|
+
if (/^f([1-9]|1[0-2])$/.test(lower)) {
|
|
139
|
+
const n = Number(lower.slice(1));
|
|
140
|
+
return nut.Key[`F${n}`];
|
|
141
|
+
}
|
|
142
|
+
if (k.length === 1) {
|
|
143
|
+
const upper = k.toUpperCase();
|
|
144
|
+
const nutKey = nut.Key[upper];
|
|
145
|
+
if (nutKey !== undefined)
|
|
146
|
+
return nutKey;
|
|
147
|
+
}
|
|
148
|
+
throw new Error(`unrecognized key: "${name}"`);
|
|
149
|
+
}
|
|
150
|
+
class WindowsInputAdapter {
|
|
151
|
+
async click(_handle, x, y, opts) {
|
|
152
|
+
const nut = getNut();
|
|
153
|
+
const mods = mapModifiers(opts?.modifiers);
|
|
154
|
+
if (mods.length)
|
|
155
|
+
await nut.keyboard.pressKey(...mods);
|
|
156
|
+
try {
|
|
157
|
+
await nut.mouse.move([new nut.Point(x, y)]);
|
|
158
|
+
const count = opts?.clickCount ?? 1;
|
|
159
|
+
// Tier A4 — explicit hold-time split for single clicks. Atomic
|
|
160
|
+
// nut-js click primitives hold the button for ~5ms; humans hold
|
|
161
|
+
// 50–150ms. Skip for double/triple clicks: they need fast cadence
|
|
162
|
+
// for the OS double-click recognizer to fire correctly.
|
|
163
|
+
const holdMs = (count === 1 && opts?.holdMs && opts.holdMs > 0) ? opts.holdMs : 0;
|
|
164
|
+
if (opts?.button === 'right') {
|
|
165
|
+
if (holdMs > 0) {
|
|
166
|
+
await nut.mouse.pressButton(nut.Button.RIGHT);
|
|
167
|
+
await new Promise((r) => setTimeout(r, holdMs));
|
|
168
|
+
await nut.mouse.releaseButton(nut.Button.RIGHT);
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
await nut.mouse.rightClick();
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
else if (opts?.button === 'middle') {
|
|
175
|
+
// nut-js doesn't expose middleClick directly in all versions — fall back to Button.MIDDLE.
|
|
176
|
+
await nut.mouse.pressButton(nut.Button.MIDDLE);
|
|
177
|
+
if (holdMs > 0)
|
|
178
|
+
await new Promise((r) => setTimeout(r, holdMs));
|
|
179
|
+
await nut.mouse.releaseButton(nut.Button.MIDDLE);
|
|
180
|
+
}
|
|
181
|
+
else if (count === 2) {
|
|
182
|
+
await nut.mouse.doubleClick();
|
|
183
|
+
}
|
|
184
|
+
else if (count === 3) {
|
|
185
|
+
await nut.mouse.leftClick();
|
|
186
|
+
await nut.mouse.leftClick();
|
|
187
|
+
await nut.mouse.leftClick();
|
|
188
|
+
}
|
|
189
|
+
else if (holdMs > 0) {
|
|
190
|
+
await nut.mouse.pressButton(nut.Button.LEFT);
|
|
191
|
+
await new Promise((r) => setTimeout(r, holdMs));
|
|
192
|
+
await nut.mouse.releaseButton(nut.Button.LEFT);
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
await nut.mouse.leftClick();
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
finally {
|
|
199
|
+
if (mods.length)
|
|
200
|
+
await nut.keyboard.releaseKey(...mods);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
async type(_handle, text, opts) {
|
|
204
|
+
const nut = getNut();
|
|
205
|
+
if (opts?.clearFirst) {
|
|
206
|
+
await nut.keyboard.pressKey(nut.Key.LeftControl, nut.Key.A);
|
|
207
|
+
await nut.keyboard.releaseKey(nut.Key.LeftControl, nut.Key.A);
|
|
208
|
+
await nut.keyboard.pressKey(nut.Key.Delete);
|
|
209
|
+
await nut.keyboard.releaseKey(nut.Key.Delete);
|
|
210
|
+
}
|
|
211
|
+
if (opts?.delayMs && opts.delayMs > 0) {
|
|
212
|
+
for (const ch of text) {
|
|
213
|
+
await nut.keyboard.type(ch);
|
|
214
|
+
await new Promise((r) => setTimeout(r, opts.delayMs));
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
await nut.keyboard.type(text);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
async typeUnicode(_handle, text, opts) {
|
|
222
|
+
const { typeUnicode } = await Promise.resolve().then(() => __importStar(require('../../../core/input-injection')));
|
|
223
|
+
await typeUnicode(text, { delayMs: opts?.delayMs });
|
|
224
|
+
}
|
|
225
|
+
async sendHotkey(handle, combo, opts) {
|
|
226
|
+
const method = opts?.method ?? 'auto';
|
|
227
|
+
// No handle → global SendInput against whatever's foreground. Caller is
|
|
228
|
+
// responsible for ensuring the right window is in front.
|
|
229
|
+
if (handle === null) {
|
|
230
|
+
await sendInputNutJs(combo);
|
|
231
|
+
return { methodUsed: 'sendinput' };
|
|
232
|
+
}
|
|
233
|
+
// Explicit override always wins over the classifier.
|
|
234
|
+
let picked;
|
|
235
|
+
if (method === 'postmessage')
|
|
236
|
+
picked = 'postmessage';
|
|
237
|
+
else if (method === 'sendinput')
|
|
238
|
+
picked = 'sendinput';
|
|
239
|
+
else
|
|
240
|
+
picked = shouldForceSendInput(opts?.processName) ? 'sendinput' : 'postmessage';
|
|
241
|
+
if (picked === 'postmessage') {
|
|
242
|
+
const { nativeId } = (0, shared_1.decodeWindowHandle)(handle);
|
|
243
|
+
const { sendComboToWindow } = await Promise.resolve().then(() => __importStar(require('../../window-input')));
|
|
244
|
+
const r = await sendComboToWindow(nativeId, combo);
|
|
245
|
+
if (!r.ok) {
|
|
246
|
+
// PostMessage queue posted but the target's message loop never reacted
|
|
247
|
+
// — classic browser / Electron / UWP behavior. Classifier should have
|
|
248
|
+
// caught this; an explicit `method: 'postmessage'` landed us here.
|
|
249
|
+
throw new errors_1.PlatformError('TARGET_HOSTILE', `PostMessage hotkey to ${nativeId} failed`, r.error ?? 'unknown reason');
|
|
250
|
+
}
|
|
251
|
+
return { methodUsed: 'postmessage' };
|
|
252
|
+
}
|
|
253
|
+
// SendInput. Caller must already have the target foreground.
|
|
254
|
+
await sendInputNutJs(combo);
|
|
255
|
+
return { methodUsed: 'sendinput' };
|
|
256
|
+
}
|
|
257
|
+
async scroll(_handle, anchor, opts) {
|
|
258
|
+
const nut = getNut();
|
|
259
|
+
await nut.mouse.move([new nut.Point(anchor.x, anchor.y)]);
|
|
260
|
+
if (opts.axis === 'x') {
|
|
261
|
+
// 2.5 — MOUSEEVENTF_HWHEEL via win32HScroll. Shift+Wheel is an option
|
|
262
|
+
// but many apps (Excel, Chromium's horizontal scroll bar) distinguish
|
|
263
|
+
// real horizontal wheel from modified vertical — prefer the real path.
|
|
264
|
+
// Fall back to Shift+Wheel via nut-js when the shell-out fails.
|
|
265
|
+
const { win32HScroll } = await Promise.resolve().then(() => __importStar(require('../../scroll-calibration')));
|
|
266
|
+
if (win32HScroll(opts.amount))
|
|
267
|
+
return;
|
|
268
|
+
// Shift+Wheel fallback — hold Shift, issue vertical wheel, release.
|
|
269
|
+
await nut.keyboard.pressKey(nut.Key.LeftShift);
|
|
270
|
+
try {
|
|
271
|
+
if (opts.amount > 0)
|
|
272
|
+
await nut.mouse.scrollDown(opts.amount);
|
|
273
|
+
else if (opts.amount < 0)
|
|
274
|
+
await nut.mouse.scrollUp(-opts.amount);
|
|
275
|
+
}
|
|
276
|
+
finally {
|
|
277
|
+
await nut.keyboard.releaseKey(nut.Key.LeftShift);
|
|
278
|
+
}
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
if (opts.amount > 0)
|
|
282
|
+
await nut.mouse.scrollDown(opts.amount);
|
|
283
|
+
else if (opts.amount < 0)
|
|
284
|
+
await nut.mouse.scrollUp(-opts.amount);
|
|
285
|
+
}
|
|
286
|
+
async drag(_handle, path, opts) {
|
|
287
|
+
if (path.length < 2) {
|
|
288
|
+
throw new Error('drag requires at least 2 points (start + end)');
|
|
289
|
+
}
|
|
290
|
+
const nut = getNut();
|
|
291
|
+
const button = opts?.button === 'right' ? nut.Button.RIGHT : nut.Button.LEFT;
|
|
292
|
+
const totalDuration = opts?.durationMs ?? 200;
|
|
293
|
+
const stepsPerSegment = Math.max(1, opts?.steps ?? 10);
|
|
294
|
+
// 3.3 — Per-segment timing. If any waypoint has atMs, honour atMs deltas
|
|
295
|
+
// between consecutive waypoints; else use equal time-slicing across
|
|
296
|
+
// totalDuration. Mixed / out-of-order atMs values fall back to equal
|
|
297
|
+
// slicing to avoid negative segment times.
|
|
298
|
+
const segments = path.length - 1;
|
|
299
|
+
const usesAtMs = path.some((p) => typeof p.atMs === 'number');
|
|
300
|
+
const perSegmentMsAll = new Array(segments);
|
|
301
|
+
if (usesAtMs) {
|
|
302
|
+
const atMs = path.map((p, i) => {
|
|
303
|
+
if (typeof p.atMs === 'number' && p.atMs >= 0)
|
|
304
|
+
return p.atMs;
|
|
305
|
+
// Fill gaps linearly across remaining duration.
|
|
306
|
+
return (i / (path.length - 1)) * totalDuration;
|
|
307
|
+
});
|
|
308
|
+
let sane = true;
|
|
309
|
+
for (let i = 0; i < segments; i++) {
|
|
310
|
+
const d = atMs[i + 1] - atMs[i];
|
|
311
|
+
if (!Number.isFinite(d) || d < 0) {
|
|
312
|
+
sane = false;
|
|
313
|
+
break;
|
|
314
|
+
}
|
|
315
|
+
perSegmentMsAll[i] = d;
|
|
316
|
+
}
|
|
317
|
+
if (!sane) {
|
|
318
|
+
const equal = totalDuration / segments;
|
|
319
|
+
for (let i = 0; i < segments; i++)
|
|
320
|
+
perSegmentMsAll[i] = equal;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
else {
|
|
324
|
+
const equal = totalDuration / segments;
|
|
325
|
+
for (let i = 0; i < segments; i++)
|
|
326
|
+
perSegmentMsAll[i] = equal;
|
|
327
|
+
}
|
|
328
|
+
const mods = mapModifiers(opts?.modifiers);
|
|
329
|
+
if (mods.length)
|
|
330
|
+
await nut.keyboard.pressKey(...mods);
|
|
331
|
+
try {
|
|
332
|
+
// Move to start, press button, interpolate through path waypoints,
|
|
333
|
+
// release. Some apps (Chromium DnD, drag-sensitive UIs) require an
|
|
334
|
+
// explicit press → sustained move → release sequence rather than
|
|
335
|
+
// nut-js's atomic .drag() helper, which is why we build from
|
|
336
|
+
// primitives.
|
|
337
|
+
//
|
|
338
|
+
// Dwell delays around the press / release are load-bearing on Win11
|
|
339
|
+
// WinUI 3 hosts (Notepad, File Explorer, Calculator, Chrome tab
|
|
340
|
+
// strip). Those apps run their drag-state initialization inside a
|
|
341
|
+
// `DragDetect`-style modal loop that needs to dequeue WM_LBUTTONDOWN
|
|
342
|
+
// from its message queue BEFORE the first WM_MOUSEMOVE arrives;
|
|
343
|
+
// without the post-press hold the LEFTDOWN + first MOVE land in the
|
|
344
|
+
// queue within the same frame and the drag state machine silently
|
|
345
|
+
// bails — cursor visibly moves but the window / tab / control
|
|
346
|
+
// doesn't follow and no "treat as click" fallback fires either.
|
|
347
|
+
// Likewise a short pre-press dwell lets hover-highlight state
|
|
348
|
+
// resolve so the subsequent hit-test picks up the intended control.
|
|
349
|
+
//
|
|
350
|
+
// The pre-release dwell is larger (100ms) because drop-acceptance
|
|
351
|
+
// state machines need to see a settled cursor at the drop location
|
|
352
|
+
// before committing — for tab tear-off in particular the tear-off
|
|
353
|
+
// preview must latch into "commit" mode before LEFTUP or the drop
|
|
354
|
+
// is interpreted as cancel-mid-flight and the tab snaps back. The
|
|
355
|
+
// post-release dwell (50ms) lets the drop handler finalize before
|
|
356
|
+
// this function returns, so callers that immediately re-query
|
|
357
|
+
// bounds read the final state rather than a transitional one.
|
|
358
|
+
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
359
|
+
await nut.mouse.setPosition(new nut.Point(path[0].x, path[0].y));
|
|
360
|
+
await sleep(20);
|
|
361
|
+
await nut.mouse.pressButton(button);
|
|
362
|
+
let pressed = true;
|
|
363
|
+
try {
|
|
364
|
+
await sleep(50);
|
|
365
|
+
for (let s = 0; s < segments; s++) {
|
|
366
|
+
const a = path[s];
|
|
367
|
+
const b = path[s + 1];
|
|
368
|
+
const segMs = perSegmentMsAll[s];
|
|
369
|
+
const stepDelay = segMs / stepsPerSegment;
|
|
370
|
+
for (let i = 1; i <= stepsPerSegment; i++) {
|
|
371
|
+
const t = i / stepsPerSegment;
|
|
372
|
+
const x = Math.round(a.x + (b.x - a.x) * t);
|
|
373
|
+
const y = Math.round(a.y + (b.y - a.y) * t);
|
|
374
|
+
await nut.mouse.setPosition(new nut.Point(x, y));
|
|
375
|
+
if (stepDelay > 0)
|
|
376
|
+
await sleep(stepDelay);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
await sleep(100);
|
|
380
|
+
await nut.mouse.releaseButton(button);
|
|
381
|
+
pressed = false;
|
|
382
|
+
await sleep(50);
|
|
383
|
+
}
|
|
384
|
+
finally {
|
|
385
|
+
if (pressed)
|
|
386
|
+
await nut.mouse.releaseButton(button);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
finally {
|
|
390
|
+
if (mods.length)
|
|
391
|
+
await nut.keyboard.releaseKey(...mods);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
async hover(_handle, x, y, opts) {
|
|
395
|
+
// 2.2 — move cursor to (x, y) and dwell for `dwellMs`. Dwell lets
|
|
396
|
+
// tooltips / hover-reveal UIs render before the caller's next action.
|
|
397
|
+
// No button press / release — pure mouse-move.
|
|
398
|
+
const nut = getNut();
|
|
399
|
+
await nut.mouse.setPosition(new nut.Point(x, y));
|
|
400
|
+
const dwell = Math.max(0, opts?.dwellMs ?? 0);
|
|
401
|
+
if (dwell > 0)
|
|
402
|
+
await new Promise((r) => setTimeout(r, dwell));
|
|
403
|
+
}
|
|
404
|
+
async getCursorPosition() {
|
|
405
|
+
// nut.mouse.getPosition() shells out to GetCursorPos on win32. Returns
|
|
406
|
+
// logical-pixel coords across the virtual screen — same coord space the
|
|
407
|
+
// rest of the input adapter accepts, so callers can feed the result
|
|
408
|
+
// straight back into click/hover/drag waypoints.
|
|
409
|
+
const nut = getNut();
|
|
410
|
+
const p = await nut.mouse.getPosition();
|
|
411
|
+
return { x: p.x, y: p.y };
|
|
412
|
+
}
|
|
413
|
+
async enumerateTrayIcons(opts) {
|
|
414
|
+
// 5.2 — Cross-process read of the Shell_TrayWnd toolbar buttons. Lazy-load
|
|
415
|
+
// the helper so a clean launch without tray_click activity pays no startup
|
|
416
|
+
// cost (the PowerShell shell-out is in module-load state otherwise).
|
|
417
|
+
const { enumerateTrayIconsWindows } = await Promise.resolve().then(() => __importStar(require('./tray')));
|
|
418
|
+
return enumerateTrayIconsWindows(opts);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
exports.WindowsInputAdapter = WindowsInputAdapter;
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Windows launch adapter — Phase 3.2 fills in `launch` (ShellExecute via
|
|
3
|
+
// Start-Process -PassThru) + `waitForWindow` (poll listWindows by processName /
|
|
4
|
+
// titleMatch). Phase 4.7 fills in `openUrl` with explicit browser selection.
|
|
5
|
+
//
|
|
6
|
+
// waitForWindow matches on processName + titleMatch (substring, case-insensitive).
|
|
7
|
+
// processId matching is not surfaced by the cross-platform listWindows() layer
|
|
8
|
+
// today (processId: 0 for all entries); when it matters, callers should pass
|
|
9
|
+
// processName instead. A future optimization could shell out to Get-Process -Id
|
|
10
|
+
// + MainWindowHandle for processId-precise matching.
|
|
11
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
14
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
15
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
16
|
+
}
|
|
17
|
+
Object.defineProperty(o, k2, desc);
|
|
18
|
+
}) : (function(o, m, k, k2) {
|
|
19
|
+
if (k2 === undefined) k2 = k;
|
|
20
|
+
o[k2] = m[k];
|
|
21
|
+
}));
|
|
22
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
23
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
24
|
+
}) : function(o, v) {
|
|
25
|
+
o["default"] = v;
|
|
26
|
+
});
|
|
27
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
28
|
+
var ownKeys = function(o) {
|
|
29
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
30
|
+
var ar = [];
|
|
31
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
32
|
+
return ar;
|
|
33
|
+
};
|
|
34
|
+
return ownKeys(o);
|
|
35
|
+
};
|
|
36
|
+
return function (mod) {
|
|
37
|
+
if (mod && mod.__esModule) return mod;
|
|
38
|
+
var result = {};
|
|
39
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
40
|
+
__setModuleDefault(result, mod);
|
|
41
|
+
return result;
|
|
42
|
+
};
|
|
43
|
+
})();
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.WindowsLaunchAdapter = void 0;
|
|
46
|
+
const childProcess = __importStar(require("child_process"));
|
|
47
|
+
const platform_1 = require("../../../core/platform");
|
|
48
|
+
const errors_1 = require("../errors");
|
|
49
|
+
const shared_1 = require("../shared");
|
|
50
|
+
class WindowsLaunchAdapter {
|
|
51
|
+
async launch(spec) {
|
|
52
|
+
if (!spec.path && !spec.name && !spec.url) {
|
|
53
|
+
throw new errors_1.PlatformError('TARGET_HOSTILE', 'launch requires one of { path, name, url }', 'Pass exactly one of the three.');
|
|
54
|
+
}
|
|
55
|
+
// path takes precedence, then url, then name.
|
|
56
|
+
const target = spec.path ?? spec.url ?? spec.name;
|
|
57
|
+
const args = spec.args ?? [];
|
|
58
|
+
const workingDir = spec.workingDir;
|
|
59
|
+
// Build the PowerShell command. Start-Process -PassThru returns a Process
|
|
60
|
+
// object whose .Id we parse back. -ArgumentList splits on commas in PS's
|
|
61
|
+
// syntax; we JSON-encode each arg to survive quoting.
|
|
62
|
+
const argList = args.length > 0
|
|
63
|
+
? `-ArgumentList @(${args.map((a) => `'${a.replace(/'/g, "''")}'`).join(',')})`
|
|
64
|
+
: '';
|
|
65
|
+
const wdFlag = workingDir ? `-WorkingDirectory '${workingDir.replace(/'/g, "''")}'` : '';
|
|
66
|
+
const targetEscaped = target.replace(/'/g, "''");
|
|
67
|
+
const cmd = `powershell -ExecutionPolicy Bypass -Command "try { $p = Start-Process -FilePath '${targetEscaped}' ${argList} ${wdFlag} -PassThru -ErrorAction Stop; Write-Output \\"ok:$($p.Id)\\" } catch { Write-Output \\"ERROR:$($_.Exception.Message)\\"; exit 1 }"`;
|
|
68
|
+
let out;
|
|
69
|
+
try {
|
|
70
|
+
out = childProcess.execSync(cmd, { encoding: 'utf-8', timeout: 10_000, stdio: 'pipe' }).trim();
|
|
71
|
+
}
|
|
72
|
+
catch (err) {
|
|
73
|
+
const e = err;
|
|
74
|
+
const stdout = (e.stdout ?? '').toString().trim();
|
|
75
|
+
if (stdout.startsWith('ERROR:')) {
|
|
76
|
+
throw new errors_1.PlatformError('TARGET_HOSTILE', `launch failed: ${stdout.replace('ERROR:', '')}`, 'Check that the path/name/url resolves and the binary is executable.');
|
|
77
|
+
}
|
|
78
|
+
throw new errors_1.PlatformError('TARGET_HOSTILE', `launch failed: ${e.message ?? String(err)}`, 'powershell Start-Process returned non-zero.');
|
|
79
|
+
}
|
|
80
|
+
if (out.startsWith('ERROR:')) {
|
|
81
|
+
throw new errors_1.PlatformError('TARGET_HOSTILE', `launch failed: ${out.replace('ERROR:', '')}`, 'Check that the path/name/url resolves and the binary is executable.');
|
|
82
|
+
}
|
|
83
|
+
if (!out.startsWith('ok:')) {
|
|
84
|
+
throw new errors_1.PlatformError('TARGET_HOSTILE', `launch returned unexpected output: ${out}`);
|
|
85
|
+
}
|
|
86
|
+
const pidStr = out.slice(3);
|
|
87
|
+
const processId = parseInt(pidStr, 10);
|
|
88
|
+
if (!Number.isFinite(processId) || processId <= 0) {
|
|
89
|
+
// URL launches often hand off to an already-running browser; Start-Process
|
|
90
|
+
// may not surface a usable PID. Return 0 so the caller can fall back to
|
|
91
|
+
// waitForWindow(processName) / (titleMatch).
|
|
92
|
+
return { processId: 0 };
|
|
93
|
+
}
|
|
94
|
+
return { processId };
|
|
95
|
+
}
|
|
96
|
+
async openUrl(url, opts) {
|
|
97
|
+
if (typeof url !== 'string' || url.length === 0) {
|
|
98
|
+
throw new errors_1.PlatformError('TARGET_HOSTILE', 'openUrl requires a non-empty url');
|
|
99
|
+
}
|
|
100
|
+
// No browser: ShellExecute routes the URL through the OS handler →
|
|
101
|
+
// default browser. Reuse the existing Start-Process path that launch()
|
|
102
|
+
// implements.
|
|
103
|
+
if (!opts?.browser) {
|
|
104
|
+
return this.launch({ url });
|
|
105
|
+
}
|
|
106
|
+
// Browser specified: Start-Process -FilePath <browser> -ArgumentList <url>.
|
|
107
|
+
// Accepts either an absolute path ("C:\\Program Files\\Google\\Chrome\\...\\chrome.exe")
|
|
108
|
+
// or a resolvable name ("chrome", "msedge", "firefox"). PowerShell's
|
|
109
|
+
// Start-Process resolves both via ShellExecute/PATH lookup.
|
|
110
|
+
const browser = opts.browser;
|
|
111
|
+
const browserEscaped = browser.replace(/'/g, "''");
|
|
112
|
+
const urlEscaped = url.replace(/'/g, "''");
|
|
113
|
+
const cmd = `powershell -ExecutionPolicy Bypass -Command "try { $p = Start-Process -FilePath '${browserEscaped}' -ArgumentList @('${urlEscaped}') -PassThru -ErrorAction Stop; Write-Output \\"ok:$($p.Id)\\" } catch { Write-Output \\"ERROR:$($_.Exception.Message)\\"; exit 1 }"`;
|
|
114
|
+
let out;
|
|
115
|
+
try {
|
|
116
|
+
out = childProcess.execSync(cmd, { encoding: 'utf-8', timeout: 10_000, stdio: 'pipe' }).trim();
|
|
117
|
+
}
|
|
118
|
+
catch (err) {
|
|
119
|
+
const e = err;
|
|
120
|
+
const stdout = (e.stdout ?? '').toString().trim();
|
|
121
|
+
if (stdout.startsWith('ERROR:')) {
|
|
122
|
+
throw new errors_1.PlatformError('TARGET_HOSTILE', `openUrl failed: ${stdout.replace('ERROR:', '')}`, `Check that "${browser}" resolves to a runnable browser executable.`);
|
|
123
|
+
}
|
|
124
|
+
throw new errors_1.PlatformError('TARGET_HOSTILE', `openUrl failed: ${e.message ?? String(err)}`, 'powershell Start-Process returned non-zero.');
|
|
125
|
+
}
|
|
126
|
+
if (out.startsWith('ERROR:')) {
|
|
127
|
+
throw new errors_1.PlatformError('TARGET_HOSTILE', `openUrl failed: ${out.replace('ERROR:', '')}`, `Check that "${browser}" resolves to a runnable browser executable.`);
|
|
128
|
+
}
|
|
129
|
+
if (!out.startsWith('ok:')) {
|
|
130
|
+
throw new errors_1.PlatformError('TARGET_HOSTILE', `openUrl returned unexpected output: ${out}`);
|
|
131
|
+
}
|
|
132
|
+
const pidStr = out.slice(3);
|
|
133
|
+
const processId = parseInt(pidStr, 10);
|
|
134
|
+
if (!Number.isFinite(processId) || processId <= 0) {
|
|
135
|
+
// Browser was already running — Start-Process may hand off to the
|
|
136
|
+
// existing instance and not surface a usable PID. Return 0 so the
|
|
137
|
+
// caller can fall back to waitForWindow(processName).
|
|
138
|
+
return { processId: 0 };
|
|
139
|
+
}
|
|
140
|
+
return { processId };
|
|
141
|
+
}
|
|
142
|
+
async waitForWindow(opts) {
|
|
143
|
+
const intervalMs = opts.intervalMs ?? 200;
|
|
144
|
+
const timeoutMs = opts.timeoutMs;
|
|
145
|
+
if (!Number.isFinite(timeoutMs) || timeoutMs <= 0) {
|
|
146
|
+
throw new errors_1.PlatformError('TARGET_HOSTILE', 'waitForWindow requires a positive timeoutMs');
|
|
147
|
+
}
|
|
148
|
+
const deadline = Date.now() + timeoutMs;
|
|
149
|
+
const titleNeedle = opts.titleMatch?.toLowerCase();
|
|
150
|
+
const procNeedle = opts.processName?.toLowerCase();
|
|
151
|
+
while (Date.now() < deadline) {
|
|
152
|
+
try {
|
|
153
|
+
const rt = (0, platform_1.getPlatform)();
|
|
154
|
+
const raw = await rt.listWindows();
|
|
155
|
+
for (const w of raw) {
|
|
156
|
+
const title = (w.name ?? '').toLowerCase();
|
|
157
|
+
const proc = (w.processName ?? '').toLowerCase();
|
|
158
|
+
// Both matchers are optional; skip entries that don't match whichever is set.
|
|
159
|
+
if (titleNeedle && !title.includes(titleNeedle))
|
|
160
|
+
continue;
|
|
161
|
+
if (procNeedle && !proc.includes(procNeedle))
|
|
162
|
+
continue;
|
|
163
|
+
// Without either matcher, we'd return the first window — refuse that
|
|
164
|
+
// footgun; require at least one.
|
|
165
|
+
if (!titleNeedle && !procNeedle)
|
|
166
|
+
break;
|
|
167
|
+
return {
|
|
168
|
+
handle: (0, shared_1.encodeWindowHandle)('win32', w.hwnd ?? w.id, 0),
|
|
169
|
+
title: w.name ?? '',
|
|
170
|
+
processName: w.processName,
|
|
171
|
+
processId: 0,
|
|
172
|
+
minimized: w.minimized,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
catch {
|
|
177
|
+
// Swallow transient listWindows failures; the polling loop retries.
|
|
178
|
+
}
|
|
179
|
+
await new Promise((r) => setTimeout(r, intervalMs));
|
|
180
|
+
}
|
|
181
|
+
return null;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
exports.WindowsLaunchAdapter = WindowsLaunchAdapter;
|