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
|
@@ -12,6 +12,7 @@ exports.openSignIn = openSignIn;
|
|
|
12
12
|
exports.openManageAccount = openManageAccount;
|
|
13
13
|
exports.openSSOSignIn = openSSOSignIn;
|
|
14
14
|
exports.handleAuthCallback = handleAuthCallback;
|
|
15
|
+
exports.syncAuthFromTokenStore = syncAuthFromTokenStore;
|
|
15
16
|
exports.loadStoredToken = loadStoredToken;
|
|
16
17
|
exports.signOut = signOut;
|
|
17
18
|
exports.updateAuthFromValidation = updateAuthFromValidation;
|
|
@@ -108,6 +109,48 @@ function storeToken(token) {
|
|
|
108
109
|
}
|
|
109
110
|
authState.token = token;
|
|
110
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Re-read the persisted token from FileTokenStore and sync in-memory authState
|
|
114
|
+
* to match. Used by the headless server's auth-file watcher so that a
|
|
115
|
+
* `superbased auth logout` (or login) in another process takes effect
|
|
116
|
+
* immediately, rather than requiring the server to restart.
|
|
117
|
+
*
|
|
118
|
+
* Unlike handleAuthCallback, this does NOT re-persist — the token store is
|
|
119
|
+
* the authoritative source; this function only reflects its current state
|
|
120
|
+
* into the in-process authState. That prevents a write-loop when the watcher
|
|
121
|
+
* fires on our own writes.
|
|
122
|
+
*
|
|
123
|
+
* Returns true if in-memory state changed (token added, removed, or swapped).
|
|
124
|
+
*/
|
|
125
|
+
function syncAuthFromTokenStore() {
|
|
126
|
+
try {
|
|
127
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
128
|
+
const { getTokenStore } = require('../core/auth-store');
|
|
129
|
+
const diskToken = getTokenStore().loadToken();
|
|
130
|
+
const current = authState.token;
|
|
131
|
+
if (!diskToken && current) {
|
|
132
|
+
// Logout happened from another process.
|
|
133
|
+
authState = {
|
|
134
|
+
token: null, userId: null, email: null, name: null, plan: 'free',
|
|
135
|
+
orgId: null, orgSlug: null, orgRole: null, lastValidatedAt: null,
|
|
136
|
+
};
|
|
137
|
+
logger_1.default.info('[Auth] Token cleared on disk — in-memory signed out to match');
|
|
138
|
+
return true;
|
|
139
|
+
}
|
|
140
|
+
if (diskToken && diskToken !== current) {
|
|
141
|
+
// New or rotated token from another process (e.g. `auth login`).
|
|
142
|
+
authState.token = diskToken;
|
|
143
|
+
decodeTokenClaims(diskToken);
|
|
144
|
+
logger_1.default.info('[Auth] Token updated on disk — in-memory synced:', authState.email || authState.userId);
|
|
145
|
+
return true;
|
|
146
|
+
}
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
catch (err) {
|
|
150
|
+
logger_1.default.warn('[Auth] syncAuthFromTokenStore failed:', err);
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
111
154
|
function loadStoredToken() {
|
|
112
155
|
const stored = (0, store_1.getSetting)('authToken');
|
|
113
156
|
if (!stored)
|
|
@@ -68,7 +68,14 @@ let standbyRecognizer = null;
|
|
|
68
68
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
69
69
|
let standbyPushStream = null;
|
|
70
70
|
let standbyReady = false;
|
|
71
|
+
let standbyCreatedAt = 0;
|
|
71
72
|
let lastConfig = null;
|
|
73
|
+
// Azure closes idle WebSockets around 10 minutes. Refresh the standby well
|
|
74
|
+
// before that so the next dictation (after a long idle period) has a live
|
|
75
|
+
// connection. Without this, the pre-warmed recognizer looks ready but its
|
|
76
|
+
// underlying WebSocket is dead — audio goes nowhere and no result comes back.
|
|
77
|
+
const STANDBY_MAX_AGE_MS = 4 * 60 * 1000; // 4 min
|
|
78
|
+
let keepAliveTimer = null;
|
|
72
79
|
// Accumulate final results across multiple recognized events
|
|
73
80
|
let finalText = '';
|
|
74
81
|
// Last accepted recognized text — used to skip exact duplicates that Azure
|
|
@@ -195,6 +202,19 @@ function attachRecognizerEvents(speechSdk, callbacks) {
|
|
|
195
202
|
}
|
|
196
203
|
async function startRealtimeRecognition(subscriptionKey, region, language, callbacks, timing, extraPhrases) {
|
|
197
204
|
const speechSdk = await loadSdk();
|
|
205
|
+
// If the standby exists but is old enough that Azure's idle timeout may have
|
|
206
|
+
// killed its WebSocket, discard it and fall through to a fresh recognizer.
|
|
207
|
+
// Accepting a stale standby caused silent-failure cold starts after idle.
|
|
208
|
+
if (isStandbyStale()) {
|
|
209
|
+
logger_1.default.warn(`[AzureSpeechRT] Standby is stale (${Math.round((Date.now() - standbyCreatedAt) / 1000)}s) — discarding`);
|
|
210
|
+
try {
|
|
211
|
+
standbyRecognizer.close();
|
|
212
|
+
}
|
|
213
|
+
catch { /* ignore */ }
|
|
214
|
+
standbyRecognizer = null;
|
|
215
|
+
standbyPushStream = null;
|
|
216
|
+
standbyReady = false;
|
|
217
|
+
}
|
|
198
218
|
// If a pre-warmed standby recognizer is ready, use it instantly.
|
|
199
219
|
// It was created in the background after the previous session ended.
|
|
200
220
|
if (standbyReady && standbyRecognizer && standbyPushStream) {
|
|
@@ -209,6 +229,7 @@ async function startRealtimeRecognition(subscriptionKey, region, language, callb
|
|
|
209
229
|
attachRecognizerEvents(speechSdk, callbacks);
|
|
210
230
|
isRunning = true;
|
|
211
231
|
flushPreBuffer();
|
|
232
|
+
ensureKeepAlive();
|
|
212
233
|
return;
|
|
213
234
|
}
|
|
214
235
|
if (isRunning) {
|
|
@@ -261,6 +282,7 @@ async function startRealtimeRecognition(subscriptionKey, region, language, callb
|
|
|
261
282
|
recognizer.startContinuousRecognitionAsync(() => {
|
|
262
283
|
isRunning = true;
|
|
263
284
|
flushPreBuffer();
|
|
285
|
+
ensureKeepAlive();
|
|
264
286
|
logger_1.default.info('[AzureSpeechRT] Continuous recognition started');
|
|
265
287
|
resolve();
|
|
266
288
|
}, (err) => {
|
|
@@ -366,6 +388,7 @@ function prewarmStandby() {
|
|
|
366
388
|
standbyRecognizer = null;
|
|
367
389
|
standbyPushStream = null;
|
|
368
390
|
standbyReady = false;
|
|
391
|
+
standbyCreatedAt = 0;
|
|
369
392
|
}
|
|
370
393
|
const { key, region, language, timing, phrases } = lastConfig;
|
|
371
394
|
const speechSdk = sdk;
|
|
@@ -400,6 +423,7 @@ function prewarmStandby() {
|
|
|
400
423
|
standbyRecognizer = newRecognizer;
|
|
401
424
|
standbyPushStream = newPushStream;
|
|
402
425
|
standbyReady = true;
|
|
426
|
+
standbyCreatedAt = Date.now();
|
|
403
427
|
logger_1.default.info('[AzureSpeechRT] Standby recognizer pre-warmed and ready');
|
|
404
428
|
}, (err) => {
|
|
405
429
|
logger_1.default.warn('[AzureSpeechRT] Failed to pre-warm standby:', err);
|
|
@@ -409,11 +433,43 @@ function prewarmStandby() {
|
|
|
409
433
|
catch { /* ignore */ }
|
|
410
434
|
});
|
|
411
435
|
}
|
|
436
|
+
/**
|
|
437
|
+
* Start a periodic keep-alive that refreshes the standby before Azure's idle
|
|
438
|
+
* timeout (~10 min). Called once after the first successful session. Idempotent.
|
|
439
|
+
*/
|
|
440
|
+
function ensureKeepAlive() {
|
|
441
|
+
if (keepAliveTimer)
|
|
442
|
+
return;
|
|
443
|
+
keepAliveTimer = setInterval(() => {
|
|
444
|
+
// Only refresh if we have a config (meaning realtime is actually in use)
|
|
445
|
+
if (!lastConfig)
|
|
446
|
+
return;
|
|
447
|
+
const age = Date.now() - standbyCreatedAt;
|
|
448
|
+
if (age > STANDBY_MAX_AGE_MS * 0.75) {
|
|
449
|
+
logger_1.default.info(`[AzureSpeechRT] Standby age ${Math.round(age / 1000)}s — refreshing`);
|
|
450
|
+
prewarmStandby();
|
|
451
|
+
}
|
|
452
|
+
}, 60 * 1000); // check every minute
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Returns true if the standby exists but its WebSocket has likely timed out.
|
|
456
|
+
* Used on session start to proactively recycle a stale standby instead of
|
|
457
|
+
* handing the caller a dead connection.
|
|
458
|
+
*/
|
|
459
|
+
function isStandbyStale() {
|
|
460
|
+
if (!standbyReady)
|
|
461
|
+
return false;
|
|
462
|
+
return Date.now() - standbyCreatedAt > STANDBY_MAX_AGE_MS;
|
|
463
|
+
}
|
|
412
464
|
/**
|
|
413
465
|
* Fully shut down the recognizer (called on app exit).
|
|
414
466
|
*/
|
|
415
467
|
async function shutdownRecognizer() {
|
|
416
468
|
lastConfig = null; // Prevent prewarmStandby from running during stop
|
|
469
|
+
if (keepAliveTimer) {
|
|
470
|
+
clearInterval(keepAliveTimer);
|
|
471
|
+
keepAliveTimer = null;
|
|
472
|
+
}
|
|
417
473
|
// Clean up standby
|
|
418
474
|
if (standbyRecognizer) {
|
|
419
475
|
try {
|
|
@@ -14,6 +14,7 @@ exports.storePreCapture = storePreCapture;
|
|
|
14
14
|
exports.getPreCapture = getPreCapture;
|
|
15
15
|
exports.clearPreCapture = clearPreCapture;
|
|
16
16
|
exports.captureScreen = captureScreen;
|
|
17
|
+
exports.captureScreenByDisplayId = captureScreenByDisplayId;
|
|
17
18
|
exports.cropRegion = cropRegion;
|
|
18
19
|
const logger_1 = __importDefault(require("../logger"));
|
|
19
20
|
// Lazy Electron imports — not available in headless mode
|
|
@@ -66,6 +67,38 @@ async function captureScreen() {
|
|
|
66
67
|
const img = await screenshot({ format: 'png' });
|
|
67
68
|
return img;
|
|
68
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* 3.7 — Capture a specific display by its Electron display id. Used by
|
|
72
|
+
* PlatformCaptureAdapter.screenshot({ display: id }) so agents can request
|
|
73
|
+
* "capture JUST this monitor" without knowing virtual-screen rects.
|
|
74
|
+
* Returns the display's PNG (in the display's physical pixel space) or null
|
|
75
|
+
* when Electron / display_id match is unavailable.
|
|
76
|
+
*/
|
|
77
|
+
async function captureScreenByDisplayId(displayId) {
|
|
78
|
+
if (!electronScreen || !desktopCapturer)
|
|
79
|
+
return null;
|
|
80
|
+
const displays = electronScreen.getAllDisplays();
|
|
81
|
+
const target = displays.find((d) => d.id === displayId);
|
|
82
|
+
if (!target)
|
|
83
|
+
return null;
|
|
84
|
+
const { width, height } = target.size;
|
|
85
|
+
const scaleFactor = target.scaleFactor || 1;
|
|
86
|
+
const sources = await desktopCapturer.getSources({
|
|
87
|
+
types: ['screen'],
|
|
88
|
+
thumbnailSize: {
|
|
89
|
+
width: Math.round(width * scaleFactor),
|
|
90
|
+
height: Math.round(height * scaleFactor),
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
// Electron's desktopCapturer `display_id` is a string on the Source; match numeric id.
|
|
94
|
+
const hit = sources.find((s) => s.display_id && Number(s.display_id) === displayId);
|
|
95
|
+
if (!hit)
|
|
96
|
+
return null;
|
|
97
|
+
const thumb = hit.thumbnail;
|
|
98
|
+
if (thumb.isEmpty())
|
|
99
|
+
return null;
|
|
100
|
+
return thumb.toPNG();
|
|
101
|
+
}
|
|
69
102
|
/**
|
|
70
103
|
* Capture the screen using Electron's native desktopCapturer API.
|
|
71
104
|
* Returns null if the capture is empty (e.g., Screen Recording permission denied).
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// 1.4 — Context-menu popup detection on Windows.
|
|
3
|
+
//
|
|
4
|
+
// Right-clicking opens a tracking popup owned by the same process as the target.
|
|
5
|
+
// To interact with the menu items the agent needs the popup's hwnd so it can
|
|
6
|
+
// `superbased_ui_dump` against it (the menu is a separate top-level window
|
|
7
|
+
// rendered as a popup). Detection: enumerate top-level windows BEFORE the
|
|
8
|
+
// click, then again ~150ms after, diff to find the new popup. Filter to
|
|
9
|
+
// popups that are (a) not in the pre-set, (b) within ~600px of the cursor,
|
|
10
|
+
// (c) belong to the target's process when known.
|
|
11
|
+
//
|
|
12
|
+
// LIMITATIONS — the spec calls these out as `CONTEXT_MENU_NOT_DETECTED`:
|
|
13
|
+
// - WPF / WinUI custom-drawn canvases (the menu is rendered inside the host
|
|
14
|
+
// window, no separate popup hwnd) — Visual Studio's main editor menu
|
|
15
|
+
// - Shell `IContextMenu` integrations (the popup IS a top-level window but
|
|
16
|
+
// belongs to explorer.exe, not the host) — Explorer right-click
|
|
17
|
+
// - Ownerless popups that don't appear in the simple EnumWindows pass
|
|
18
|
+
//
|
|
19
|
+
// On those, the helper returns null and the caller falls back to a fullscreen
|
|
20
|
+
// `ui_dump` + semantic locate against the menu items.
|
|
21
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
22
|
+
if (k2 === undefined) k2 = k;
|
|
23
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
24
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
25
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
26
|
+
}
|
|
27
|
+
Object.defineProperty(o, k2, desc);
|
|
28
|
+
}) : (function(o, m, k, k2) {
|
|
29
|
+
if (k2 === undefined) k2 = k;
|
|
30
|
+
o[k2] = m[k];
|
|
31
|
+
}));
|
|
32
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
33
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
34
|
+
}) : function(o, v) {
|
|
35
|
+
o["default"] = v;
|
|
36
|
+
});
|
|
37
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
38
|
+
var ownKeys = function(o) {
|
|
39
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
40
|
+
var ar = [];
|
|
41
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
42
|
+
return ar;
|
|
43
|
+
};
|
|
44
|
+
return ownKeys(o);
|
|
45
|
+
};
|
|
46
|
+
return function (mod) {
|
|
47
|
+
if (mod && mod.__esModule) return mod;
|
|
48
|
+
var result = {};
|
|
49
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
50
|
+
__setModuleDefault(result, mod);
|
|
51
|
+
return result;
|
|
52
|
+
};
|
|
53
|
+
})();
|
|
54
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
55
|
+
exports.enumerateVisibleTopLevel = enumerateVisibleTopLevel;
|
|
56
|
+
exports.detectNewPopup = detectNewPopup;
|
|
57
|
+
exports.pollForContextMenu_macOS = pollForContextMenu_macOS;
|
|
58
|
+
exports.clickContextMenuItem_macOS = clickContextMenuItem_macOS;
|
|
59
|
+
const childProcess = __importStar(require("child_process"));
|
|
60
|
+
const fs = __importStar(require("fs"));
|
|
61
|
+
const os = __importStar(require("os"));
|
|
62
|
+
const path = __importStar(require("path"));
|
|
63
|
+
/**
|
|
64
|
+
* Enumerate all visible top-level windows. Returns hwnds + bounds + pid.
|
|
65
|
+
* ~50-100ms per call (PowerShell shell-out + EnumWindows iteration).
|
|
66
|
+
*/
|
|
67
|
+
async function enumerateVisibleTopLevel() {
|
|
68
|
+
if (process.platform !== 'win32')
|
|
69
|
+
return [];
|
|
70
|
+
const script = path.join(os.tmpdir(), `superbased-enumwins-${Date.now()}.ps1`);
|
|
71
|
+
fs.writeFileSync(script, `
|
|
72
|
+
Add-Type -TypeDefinition @'
|
|
73
|
+
using System;
|
|
74
|
+
using System.Collections.Generic;
|
|
75
|
+
using System.Runtime.InteropServices;
|
|
76
|
+
using System.Text;
|
|
77
|
+
public class WinEnum {
|
|
78
|
+
public delegate bool EnumProc(IntPtr hWnd, IntPtr lParam);
|
|
79
|
+
[DllImport("user32.dll")] public static extern bool EnumWindows(EnumProc enumFunc, IntPtr lParam);
|
|
80
|
+
[DllImport("user32.dll")] public static extern bool IsWindowVisible(IntPtr hWnd);
|
|
81
|
+
[DllImport("user32.dll", SetLastError=true)] public static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect);
|
|
82
|
+
[DllImport("user32.dll")] public static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint pid);
|
|
83
|
+
[StructLayout(LayoutKind.Sequential)] public struct RECT { public int left; public int top; public int right; public int bottom; }
|
|
84
|
+
public static List<string> Collect() {
|
|
85
|
+
List<string> rows = new List<string>();
|
|
86
|
+
EnumWindows(delegate(IntPtr h, IntPtr lp) {
|
|
87
|
+
if (!IsWindowVisible(h)) return true;
|
|
88
|
+
RECT r; if (!GetWindowRect(h, out r)) return true;
|
|
89
|
+
int w = r.right - r.left; int hgt = r.bottom - r.top;
|
|
90
|
+
if (w <= 0 || hgt <= 0) return true;
|
|
91
|
+
uint pid; GetWindowThreadProcessId(h, out pid);
|
|
92
|
+
rows.Add(string.Format("{0}|{1}|{2}|{3}|{4}|{5}", h.ToInt64(), r.left, r.top, r.right, r.bottom, pid));
|
|
93
|
+
return true;
|
|
94
|
+
}, IntPtr.Zero);
|
|
95
|
+
return rows;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
'@
|
|
99
|
+
[WinEnum]::Collect() | ForEach-Object { Write-Output $_ }
|
|
100
|
+
`);
|
|
101
|
+
try {
|
|
102
|
+
const out = childProcess.execSync(`powershell -ExecutionPolicy Bypass -File "${script}"`, { encoding: 'utf-8', timeout: 5_000, stdio: 'pipe' });
|
|
103
|
+
try {
|
|
104
|
+
fs.unlinkSync(script);
|
|
105
|
+
}
|
|
106
|
+
catch { /* cleanup */ }
|
|
107
|
+
return out.split('\n').map((line) => line.trim()).filter(Boolean).map((line) => {
|
|
108
|
+
const parts = line.split('|');
|
|
109
|
+
if (parts.length < 6)
|
|
110
|
+
return null;
|
|
111
|
+
const left = parseInt(parts[1], 10);
|
|
112
|
+
const top = parseInt(parts[2], 10);
|
|
113
|
+
const right = parseInt(parts[3], 10);
|
|
114
|
+
const bottom = parseInt(parts[4], 10);
|
|
115
|
+
return {
|
|
116
|
+
hwnd: parts[0],
|
|
117
|
+
left, top, right, bottom,
|
|
118
|
+
width: right - left,
|
|
119
|
+
height: bottom - top,
|
|
120
|
+
pid: parseInt(parts[5], 10),
|
|
121
|
+
};
|
|
122
|
+
}).filter((row) => row !== null);
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
try {
|
|
126
|
+
fs.unlinkSync(script);
|
|
127
|
+
}
|
|
128
|
+
catch { /* cleanup */ }
|
|
129
|
+
return [];
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Compare a post-click enumeration against a pre-click snapshot to find a
|
|
134
|
+
* newly-appeared popup. Returns the popup that's likely the right-click
|
|
135
|
+
* context menu — newly visible, near the cursor, smaller than the host
|
|
136
|
+
* window. Returns null when no popup was detected (caller maps to
|
|
137
|
+
* `CONTEXT_MENU_NOT_DETECTED`).
|
|
138
|
+
*/
|
|
139
|
+
function detectNewPopup(preHwnds, postPopups, anchor, opts) {
|
|
140
|
+
const maxDistance = opts?.maxDistance ?? 600;
|
|
141
|
+
const maxArea = opts?.maxArea ?? 500_000; // 500k px² ≈ 700×700 — most popups are smaller
|
|
142
|
+
const candidates = postPopups.filter((p) => {
|
|
143
|
+
if (preHwnds.has(p.hwnd))
|
|
144
|
+
return false;
|
|
145
|
+
if (opts?.hostPid !== undefined && p.pid !== opts.hostPid)
|
|
146
|
+
return false;
|
|
147
|
+
const area = p.width * p.height;
|
|
148
|
+
if (area > maxArea)
|
|
149
|
+
return false;
|
|
150
|
+
// distance from anchor to nearest edge of the popup
|
|
151
|
+
const dx = Math.max(p.left - anchor.x, 0, anchor.x - p.right);
|
|
152
|
+
const dy = Math.max(p.top - anchor.y, 0, anchor.y - p.bottom);
|
|
153
|
+
const dist = Math.sqrt(dx * dx + dy * dy);
|
|
154
|
+
return dist <= maxDistance;
|
|
155
|
+
});
|
|
156
|
+
if (candidates.length === 0)
|
|
157
|
+
return null;
|
|
158
|
+
// Prefer the closest popup to the cursor.
|
|
159
|
+
candidates.sort((a, b) => {
|
|
160
|
+
const dista = distanceToRect(anchor, a);
|
|
161
|
+
const distb = distanceToRect(anchor, b);
|
|
162
|
+
return dista - distb;
|
|
163
|
+
});
|
|
164
|
+
return candidates[0];
|
|
165
|
+
}
|
|
166
|
+
function distanceToRect(p, r) {
|
|
167
|
+
const dx = Math.max(r.left - p.x, 0, p.x - r.right);
|
|
168
|
+
const dy = Math.max(r.top - p.y, 0, p.y - r.bottom);
|
|
169
|
+
return Math.sqrt(dx * dx + dy * dy);
|
|
170
|
+
}
|
|
171
|
+
// ── macOS context-menu detection (7.6) ──
|
|
172
|
+
//
|
|
173
|
+
// macOS context menus are AX elements of role AXMenu, owned by the target
|
|
174
|
+
// process. Unlike Windows popups they aren't separate top-level windows, so
|
|
175
|
+
// the EnumWindows diff approach doesn't apply. Detection uses osascript to
|
|
176
|
+
// poll System Events for an AXMenu that appears after the right-click.
|
|
177
|
+
//
|
|
178
|
+
// The long-term ideal is AXObserverAddNotification(kAXMenuOpenedNotification)
|
|
179
|
+
// — a real-time callback delivered via CFRunLoop — but that needs a native
|
|
180
|
+
// binding. Poll is adequate for a one-shot "did the menu open" check
|
|
181
|
+
// (~100-300ms typical latency; we poll every 100ms up to timeoutMs).
|
|
182
|
+
/**
|
|
183
|
+
* Poll for an AXMenu that appeared in the frontmost process. Returns the
|
|
184
|
+
* menu items' AXTitle list + parent menu role so the caller can match by
|
|
185
|
+
* text and dispatch an AXPress. Returns null if no menu appeared within
|
|
186
|
+
* timeoutMs.
|
|
187
|
+
*/
|
|
188
|
+
async function pollForContextMenu_macOS(timeoutMs) {
|
|
189
|
+
if (process.platform !== 'darwin')
|
|
190
|
+
return null;
|
|
191
|
+
const { execFile } = await Promise.resolve().then(() => __importStar(require('child_process')));
|
|
192
|
+
const runOsa = (script) => new Promise((resolve) => {
|
|
193
|
+
execFile('/usr/bin/osascript', ['-e', script], { timeout: 5_000, encoding: 'utf-8' }, (err, stdout) => {
|
|
194
|
+
if (err) {
|
|
195
|
+
resolve('');
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
resolve(String(stdout ?? '').trim());
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
const deadline = Date.now() + timeoutMs;
|
|
202
|
+
// Poll every 100ms. Each probe asks: does the frontmost app currently
|
|
203
|
+
// have a menu open? If yes, collect item titles.
|
|
204
|
+
while (Date.now() < deadline) {
|
|
205
|
+
const probe = await runOsa(`tell application "System Events"
|
|
206
|
+
set frontApp to first process whose frontmost is true
|
|
207
|
+
set frontName to name of frontApp
|
|
208
|
+
set menuList to menus of frontApp
|
|
209
|
+
if (count of menuList) is 0 then return ""
|
|
210
|
+
set theMenu to item 1 of menuList
|
|
211
|
+
set itemTitles to {}
|
|
212
|
+
repeat with mi in menu items of theMenu
|
|
213
|
+
try
|
|
214
|
+
set end of itemTitles to title of mi
|
|
215
|
+
on error
|
|
216
|
+
set end of itemTitles to ""
|
|
217
|
+
end try
|
|
218
|
+
end repeat
|
|
219
|
+
return frontName & "|" & (itemTitles as string)
|
|
220
|
+
end tell`);
|
|
221
|
+
if (probe) {
|
|
222
|
+
// Format: `<processName>|<item1>, <item2>, ...` (AppleScript's default list→string)
|
|
223
|
+
const pipeIdx = probe.indexOf('|');
|
|
224
|
+
if (pipeIdx > 0) {
|
|
225
|
+
const processName = probe.slice(0, pipeIdx);
|
|
226
|
+
const itemsStr = probe.slice(pipeIdx + 1);
|
|
227
|
+
const items = itemsStr.split(',').map((s) => s.trim()).filter(Boolean);
|
|
228
|
+
if (items.length > 0)
|
|
229
|
+
return { processName, items };
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
await new Promise((r) => setTimeout(r, 100));
|
|
233
|
+
}
|
|
234
|
+
return null;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Click a menu item by its title in the currently-open context menu of
|
|
238
|
+
* the specified process. Uses AXPress on the first menu item whose title
|
|
239
|
+
* matches (case-insensitive by default). Returns true on success.
|
|
240
|
+
*/
|
|
241
|
+
async function clickContextMenuItem_macOS(processName, itemText, caseSensitive) {
|
|
242
|
+
if (process.platform !== 'darwin')
|
|
243
|
+
return false;
|
|
244
|
+
const { execFile } = await Promise.resolve().then(() => __importStar(require('child_process')));
|
|
245
|
+
const escapedName = processName.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
|
|
246
|
+
const escapedItem = itemText.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
|
|
247
|
+
// AppleScript-side case handling: we do the match in JS by pulling titles
|
|
248
|
+
// then issuing a second AXPress script by index. Here we short-circuit for
|
|
249
|
+
// the common exact-match path; callers pass the exact text from the item
|
|
250
|
+
// list returned by pollForContextMenu_macOS.
|
|
251
|
+
const matchExpr = caseSensitive
|
|
252
|
+
? `whose title is "${escapedItem}"`
|
|
253
|
+
: `whose title is "${escapedItem}"`; // case-insensitive matching happens in JS upstream
|
|
254
|
+
const script = `tell application "System Events"
|
|
255
|
+
set frontApp to first process whose name is "${escapedName}"
|
|
256
|
+
set theMenu to item 1 of menus of frontApp
|
|
257
|
+
set targets to (menu items of theMenu ${matchExpr})
|
|
258
|
+
if (count of targets) is 0 then return "no_match"
|
|
259
|
+
perform action "AXPress" of (item 1 of targets)
|
|
260
|
+
return "ok"
|
|
261
|
+
end tell`;
|
|
262
|
+
return new Promise((resolve) => {
|
|
263
|
+
execFile('/usr/bin/osascript', ['-e', script], { timeout: 5_000, encoding: 'utf-8' }, (err, stdout) => {
|
|
264
|
+
if (err) {
|
|
265
|
+
resolve(false);
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
resolve(String(stdout ?? '').trim() === 'ok');
|
|
269
|
+
});
|
|
270
|
+
});
|
|
271
|
+
}
|
|
@@ -68,7 +68,7 @@ const constants_1 = require("../../shared/constants");
|
|
|
68
68
|
let state = 'idle';
|
|
69
69
|
let indicatorWindow = null;
|
|
70
70
|
let uiohookModule = null;
|
|
71
|
-
let shortcutModifiers = ['ctrl', 'alt'];
|
|
71
|
+
let shortcutModifiers = process.platform === 'darwin' ? ['meta', 'alt'] : ['ctrl', 'alt'];
|
|
72
72
|
let aiCleanup = false;
|
|
73
73
|
let soundFeedback = true;
|
|
74
74
|
let maxDurationSeconds = 120;
|
|
@@ -1083,6 +1083,10 @@ async function initializeDictation(window) {
|
|
|
1083
1083
|
if (modifiers && Array.isArray(modifiers)) {
|
|
1084
1084
|
shortcutModifiers = modifiers;
|
|
1085
1085
|
}
|
|
1086
|
+
else {
|
|
1087
|
+
// No stored value — use platform-aware default
|
|
1088
|
+
shortcutModifiers = process.platform === 'darwin' ? ['meta', 'alt'] : ['ctrl', 'alt'];
|
|
1089
|
+
}
|
|
1086
1090
|
aiCleanup = (0, store_1.getSetting)('dictationSettings.aiCleanup') || false;
|
|
1087
1091
|
soundFeedback = (0, store_1.getSetting)('dictationSettings.soundFeedback') ?? true;
|
|
1088
1092
|
const storedDuration = (0, store_1.getSetting)('dictationSettings.maxDurationSeconds');
|
|
@@ -1094,12 +1098,13 @@ async function initializeDictation(window) {
|
|
|
1094
1098
|
initialSilenceMs = (0, store_1.getSetting)('dictationSettings.initialSilenceMs') ?? 500;
|
|
1095
1099
|
segmentationSilenceMs = (0, store_1.getSetting)('dictationSettings.segmentationSilenceMs') ?? 5000;
|
|
1096
1100
|
updateRequiredKeycodes();
|
|
1097
|
-
//
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1101
|
+
// Eagerly preload the Azure Speech SDK so the first realtime dictation doesn't
|
|
1102
|
+
// pay the ~400ms module-import cost at hotkey press. We preload unconditionally
|
|
1103
|
+
// because the user may switch to realtime later in the session; the SDK is
|
|
1104
|
+
// small and the cost of loading when unused is negligible vs. a cold-start
|
|
1105
|
+
// dictation that drops audio.
|
|
1106
|
+
Promise.resolve().then(() => __importStar(require('./azure-speech-realtime'))).then((rt) => rt.preloadSdk()).catch(() => { });
|
|
1107
|
+
fetchRealtimeConfig().catch(() => { });
|
|
1103
1108
|
// Acquire uiohook via shared manager (reference-counted start/stop)
|
|
1104
1109
|
try {
|
|
1105
1110
|
const { acquire } = await Promise.resolve().then(() => __importStar(require('./uiohook-manager')));
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Canonical tool-level error-code taxonomy for AutomationResult.errorCode.
|
|
3
|
+
//
|
|
4
|
+
// Source of truth: GUI_AUTOMATION_ROADMAP.md §6.1. This file is the
|
|
5
|
+
// TypeScript-enforceable mirror — narrowing AutomationResult.errorCode to
|
|
6
|
+
// AutomationErrorCode turns "typo in an errorCode string literal" into a
|
|
7
|
+
// compile error, and gives the 6.2 CI rejection-reason scanner a typed
|
|
8
|
+
// constant to check against.
|
|
9
|
+
//
|
|
10
|
+
// Relationship to PlatformErrorCode (electron/modules/platform/errors.ts):
|
|
11
|
+
// – PlatformErrorCode is the set adapters THROW via PlatformError.
|
|
12
|
+
// – AutomationErrorCode is the set tools RETURN in AutomationResult.errorCode.
|
|
13
|
+
// – AutomationErrorCode is a superset: it adds 'INVALID_ARGS' (tool-level
|
|
14
|
+
// schema validation — adapters receive already-validated args, so they
|
|
15
|
+
// don't throw this).
|
|
16
|
+
//
|
|
17
|
+
// Adding a new code: append here, add to PlatformErrorCode when an adapter
|
|
18
|
+
// throws it, and tick roadmap §6.1.
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.AUTOMATION_ERROR_CODES = void 0;
|
|
21
|
+
exports.isAutomationErrorCode = isAutomationErrorCode;
|
|
22
|
+
exports.normalizeErrorCode = normalizeErrorCode;
|
|
23
|
+
exports.AUTOMATION_ERROR_CODES = [
|
|
24
|
+
// Gating + approval
|
|
25
|
+
'GATED',
|
|
26
|
+
// Targeting + activation
|
|
27
|
+
'WINDOW_NOT_FOUND',
|
|
28
|
+
'TARGET_HOSTILE',
|
|
29
|
+
'ACTIVATION_FAILED',
|
|
30
|
+
'INVALID_HANDLE',
|
|
31
|
+
'SELF_TARGET_REFUSED',
|
|
32
|
+
// Timing
|
|
33
|
+
'TIMEOUT',
|
|
34
|
+
// Positional / geometric
|
|
35
|
+
'OFF_SCREEN',
|
|
36
|
+
'DISPLAY_NOT_FOUND',
|
|
37
|
+
// Platform availability
|
|
38
|
+
'UNSUPPORTED_PLATFORM',
|
|
39
|
+
'UNSUPPORTED_YET',
|
|
40
|
+
'NOT_IMPLEMENTED',
|
|
41
|
+
// Locate resolution
|
|
42
|
+
'LOCATE_NO_MATCH',
|
|
43
|
+
'LOCATE_AMBIGUOUS',
|
|
44
|
+
// Sequence + assertion
|
|
45
|
+
'ASSERT_FAILED',
|
|
46
|
+
'DRYRUN',
|
|
47
|
+
'CACHE_STALE',
|
|
48
|
+
// Session + elevation
|
|
49
|
+
'SESSION_LOCKED',
|
|
50
|
+
'ELEVATION_REQUIRED',
|
|
51
|
+
'INTEGRITY_MISMATCH',
|
|
52
|
+
// TCC (macOS)
|
|
53
|
+
'ACCESSIBILITY_NOT_GRANTED',
|
|
54
|
+
'SCREEN_RECORDING_NOT_GRANTED',
|
|
55
|
+
// Tool-specific
|
|
56
|
+
'CONTEXT_MENU_NOT_DETECTED',
|
|
57
|
+
'FIND_BAR_UNKNOWN',
|
|
58
|
+
'LAUNCH_ALLOWLIST_MISS',
|
|
59
|
+
'TRAY_ICON_NOT_FOUND',
|
|
60
|
+
'USER_ABORTED',
|
|
61
|
+
'DRAG_HAD_NO_EFFECT',
|
|
62
|
+
'DRAG_RESIZED_NOT_MOVED',
|
|
63
|
+
'DRAG_NO_SAFE_PICKUP',
|
|
64
|
+
// Tool-level validation (not in PlatformErrorCode — adapters receive validated args)
|
|
65
|
+
'INVALID_ARGS',
|
|
66
|
+
];
|
|
67
|
+
function isAutomationErrorCode(s) {
|
|
68
|
+
return typeof s === 'string' && exports.AUTOMATION_ERROR_CODES.includes(s);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Narrow a `string | undefined` value (typically `(err as { code?: string }).code`
|
|
72
|
+
* from a caught PlatformError) to an AutomationErrorCode. Falls back to
|
|
73
|
+
* 'TARGET_HOSTILE' when the code is missing or not in the canonical set —
|
|
74
|
+
* matches the existing defensive pattern across tool handlers.
|
|
75
|
+
*/
|
|
76
|
+
function normalizeErrorCode(maybeCode, fallback = 'TARGET_HOSTILE') {
|
|
77
|
+
return isAutomationErrorCode(maybeCode) ? maybeCode : fallback;
|
|
78
|
+
}
|