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,744 @@
|
|
|
1
|
+
// Ink TUI — `superbased settings`.
|
|
2
|
+
//
|
|
3
|
+
// Why .mjs and not .ts?
|
|
4
|
+
// ink 7 is ESM-only. Our headless build is commonjs. Wiring .mts + a second
|
|
5
|
+
// tsconfig adds build ceremony that doesn't buy much for 5 small ink
|
|
6
|
+
// components. We accept the type-safety loss on the UI layer only — the
|
|
7
|
+
// settings schema, stores, and config CLI remain strict TS. Imports from
|
|
8
|
+
// this file go through compiled .js output, so refactors elsewhere can't
|
|
9
|
+
// silently break it — ink will throw at runtime if a path is stale.
|
|
10
|
+
//
|
|
11
|
+
// Why React.createElement instead of JSX?
|
|
12
|
+
// Same reason — no JSX transform needed, no build step, the TUI ships as
|
|
13
|
+
// source .mjs files copied verbatim into dist. Minor ergonomic cost for a
|
|
14
|
+
// UI this size.
|
|
15
|
+
|
|
16
|
+
import React from 'react';
|
|
17
|
+
import { render, Box, Text, useInput, useApp } from 'ink';
|
|
18
|
+
import SelectInput from 'ink-select-input';
|
|
19
|
+
import TextInput from 'ink-text-input';
|
|
20
|
+
|
|
21
|
+
import {
|
|
22
|
+
SECTIONS,
|
|
23
|
+
getExposedFields,
|
|
24
|
+
getByPath,
|
|
25
|
+
validateValue,
|
|
26
|
+
isFieldVisibleTo,
|
|
27
|
+
} from '../../electron/core/settings-schema.js';
|
|
28
|
+
import {
|
|
29
|
+
getAllSettings,
|
|
30
|
+
setSetting,
|
|
31
|
+
deleteSetting,
|
|
32
|
+
} from '../../electron/core/json-store.js';
|
|
33
|
+
|
|
34
|
+
const h = React.createElement;
|
|
35
|
+
|
|
36
|
+
// ── polling hook ─────────────────────────────────────────────────────────
|
|
37
|
+
//
|
|
38
|
+
// Phase 8.4 — shared `usePolling` hook for the three live panels below.
|
|
39
|
+
// Polling "pauses" on unmount: SectionDetail only renders a panel when its
|
|
40
|
+
// section is the selected one, so navigating away unmounts the panel and
|
|
41
|
+
// halts the interval (React's mount/unmount cycle does the heavy lifting —
|
|
42
|
+
// document.visibilityState has no clean TTY analogue). The explicit
|
|
43
|
+
// `enabled` gate is defensive for any future layout that keeps panels
|
|
44
|
+
// mounted across sections; today all three pass the default `enabled:
|
|
45
|
+
// true` via the `isActive` prop on SectionDetail's conditional render.
|
|
46
|
+
//
|
|
47
|
+
// `offlineSentinel` preserves the SpeechModelsPanel's prior behavior of
|
|
48
|
+
// treating fetch failures as a distinct "serve not running" state rather
|
|
49
|
+
// than a generic error (lets the panel fall back to catalog-only UI with a
|
|
50
|
+
// "start superbased serve" hint).
|
|
51
|
+
function usePolling(url, intervalMs, options = {}) {
|
|
52
|
+
const { enabled = true, offlineSentinel } = options;
|
|
53
|
+
const [data, setData] = React.useState(null);
|
|
54
|
+
const [error, setError] = React.useState(null);
|
|
55
|
+
|
|
56
|
+
React.useEffect(() => {
|
|
57
|
+
if (!enabled) return undefined;
|
|
58
|
+
let cancelled = false;
|
|
59
|
+
async function refresh() {
|
|
60
|
+
try {
|
|
61
|
+
const res = await fetch(url);
|
|
62
|
+
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
|
63
|
+
const parsed = await res.json();
|
|
64
|
+
if (!cancelled) { setData(parsed); setError(null); }
|
|
65
|
+
} catch (err) {
|
|
66
|
+
if (cancelled) return;
|
|
67
|
+
if (offlineSentinel !== undefined) {
|
|
68
|
+
setData(offlineSentinel);
|
|
69
|
+
setError(null);
|
|
70
|
+
} else {
|
|
71
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
72
|
+
setData(null);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
refresh();
|
|
77
|
+
const timer = setInterval(refresh, intervalMs);
|
|
78
|
+
return () => { cancelled = true; clearInterval(timer); };
|
|
79
|
+
}, [url, intervalMs, enabled, offlineSentinel]);
|
|
80
|
+
|
|
81
|
+
return { data, error };
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// ── utilities ────────────────────────────────────────────────────────────
|
|
85
|
+
|
|
86
|
+
function formatValue(v) {
|
|
87
|
+
if (v === undefined) return '(unset)';
|
|
88
|
+
if (v === '') return "''";
|
|
89
|
+
if (Array.isArray(v)) return v.length === 0 ? '[]' : `[${v.map(String).join(', ')}]`;
|
|
90
|
+
if (typeof v === 'object') return JSON.stringify(v);
|
|
91
|
+
return String(v);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function visibleFieldsForSection(section) {
|
|
95
|
+
return section.fields.filter((f) => isFieldVisibleTo(f, 'tui'));
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function visibleSections() {
|
|
99
|
+
return SECTIONS.filter((s) => visibleFieldsForSection(s).length > 0);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// ── components ───────────────────────────────────────────────────────────
|
|
103
|
+
|
|
104
|
+
// Sidebar — list of section labels, up/down to move, Enter to drill in.
|
|
105
|
+
function Sidebar({ sections, selectedIndex, onSelect }) {
|
|
106
|
+
const items = sections.map((s, i) => ({ label: s.label, value: String(i) }));
|
|
107
|
+
return h(
|
|
108
|
+
Box,
|
|
109
|
+
{ flexDirection: 'column', paddingRight: 2, borderStyle: 'single', width: 28 },
|
|
110
|
+
h(Text, { bold: true }, 'SuperBased settings'),
|
|
111
|
+
h(Text, { dimColor: true }, 'arrows · enter · esc · q'),
|
|
112
|
+
h(Text, null, ''),
|
|
113
|
+
h(SelectInput, {
|
|
114
|
+
items,
|
|
115
|
+
initialIndex: selectedIndex,
|
|
116
|
+
onSelect: (item) => onSelect(Number(item.value)),
|
|
117
|
+
}),
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Lists installed + available speech models, polling /api/stt/status so
|
|
122
|
+
// the panel reflects external mutations (a user running `superbased stt
|
|
123
|
+
// download ...` in another terminal, a model file being removed manually,
|
|
124
|
+
// etc.). Phase 4e keeps this panel read-only: add/remove actions print
|
|
125
|
+
// the exact CLI command to run; future follow-up can wire in-TUI download
|
|
126
|
+
// through the existing SSE /api/stt/download-model endpoint.
|
|
127
|
+
function SpeechModelsPanel({ isActive = true }) {
|
|
128
|
+
const [catalog, setCatalog] = React.useState(null);
|
|
129
|
+
const [catalogError, setCatalogError] = React.useState(null);
|
|
130
|
+
|
|
131
|
+
React.useEffect(() => {
|
|
132
|
+
let cancelled = false;
|
|
133
|
+
(async () => {
|
|
134
|
+
try {
|
|
135
|
+
const modelMgr = await import('../../electron/modules/stt/model-manager.js');
|
|
136
|
+
if (!cancelled) setCatalog(modelMgr.MODEL_CATALOG);
|
|
137
|
+
} catch (err) {
|
|
138
|
+
if (!cancelled) setCatalogError(err instanceof Error ? err.message : String(err));
|
|
139
|
+
}
|
|
140
|
+
})();
|
|
141
|
+
return () => { cancelled = true; };
|
|
142
|
+
}, []);
|
|
143
|
+
|
|
144
|
+
// Probe failure just means `serve` isn't running. Fall back to the
|
|
145
|
+
// 'offline' sentinel so the panel still renders something useful when the
|
|
146
|
+
// user is running this TUI standalone.
|
|
147
|
+
const { data: probe } = usePolling(
|
|
148
|
+
'http://127.0.0.1:47592/api/stt/status',
|
|
149
|
+
2000,
|
|
150
|
+
{ enabled: isActive, offlineSentinel: 'offline' },
|
|
151
|
+
);
|
|
152
|
+
|
|
153
|
+
if (catalogError) {
|
|
154
|
+
return h(
|
|
155
|
+
Box,
|
|
156
|
+
{ flexDirection: 'column', marginTop: 1 },
|
|
157
|
+
h(Text, { dimColor: true }, 'Speech models'),
|
|
158
|
+
h(Text, { color: 'red' }, ` failed to load catalog: ${catalogError}`),
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
if (!catalog) {
|
|
162
|
+
return h(
|
|
163
|
+
Box,
|
|
164
|
+
{ flexDirection: 'column', marginTop: 1 },
|
|
165
|
+
h(Text, { dimColor: true }, 'Speech models'),
|
|
166
|
+
h(Text, { color: 'gray' }, ' loading catalog…'),
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// Determine install state per model. The HTTP probe only reports on the
|
|
171
|
+
// currently-configured model; for other catalog entries we'd need a
|
|
172
|
+
// separate probe pass. For v1 (single-model catalog), the HTTP probe is
|
|
173
|
+
// authoritative. When the catalog grows in later phases, extend this
|
|
174
|
+
// effect to probe each entry independently (or add a batch endpoint).
|
|
175
|
+
function isInstalled(entry) {
|
|
176
|
+
if (probe && typeof probe === 'object' && probe.sherpa?.modelId === entry.id) {
|
|
177
|
+
return !!probe.sherpa.modelDownloaded;
|
|
178
|
+
}
|
|
179
|
+
return null; // unknown — serve isn't running or model not configured
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const children = [
|
|
183
|
+
h(Text, { key: '_label', dimColor: true }, 'Speech models'),
|
|
184
|
+
];
|
|
185
|
+
for (const entry of catalog) {
|
|
186
|
+
const installed = isInstalled(entry);
|
|
187
|
+
const mark = installed === true ? '✓' : installed === false ? '○' : '?';
|
|
188
|
+
const color = installed === true ? 'green' : installed === false ? 'gray' : 'yellow';
|
|
189
|
+
const sizeLabel = `~${entry.sizeMb} MB`;
|
|
190
|
+
children.push(
|
|
191
|
+
h(Text, { key: `${entry.id}-header`, color },
|
|
192
|
+
` ${mark} ${entry.id} (${entry.language}, ${sizeLabel})`),
|
|
193
|
+
h(Text, { key: `${entry.id}-name`, dimColor: true },
|
|
194
|
+
` ${entry.displayName}`),
|
|
195
|
+
);
|
|
196
|
+
if (installed === true) {
|
|
197
|
+
const modelPath = probe && probe.sherpa && probe.sherpa.modelPath;
|
|
198
|
+
if (modelPath) {
|
|
199
|
+
children.push(h(Text, { key: `${entry.id}-path`, dimColor: true }, ` ${modelPath}`));
|
|
200
|
+
}
|
|
201
|
+
children.push(h(Text, { key: `${entry.id}-rm`, dimColor: true },
|
|
202
|
+
` remove: superbased stt remove ${entry.id}`));
|
|
203
|
+
} else if (installed === false) {
|
|
204
|
+
children.push(h(Text, { key: `${entry.id}-dl`, dimColor: true },
|
|
205
|
+
` download: superbased stt download ${entry.id}`));
|
|
206
|
+
} else {
|
|
207
|
+
children.push(h(Text, { key: `${entry.id}-unknown`, color: 'yellow' },
|
|
208
|
+
' (start `superbased serve` to see install state)'));
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
children.push(h(Text, { key: '_footer', dimColor: true },
|
|
212
|
+
' tip: enable auto-download in the stt.sherpa.autoDownloadOnFirstUse field above'));
|
|
213
|
+
|
|
214
|
+
return h(Box, { flexDirection: 'column', marginTop: 1 }, ...children);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// Phase 6.1 — Ollama detection panel. Polls /api/ollama/status every 2s so
|
|
218
|
+
// external state changes (daemon started / stopped, new models pulled) show
|
|
219
|
+
// up without restarting the TUI. Read-only in 6.1: routing toggles land in
|
|
220
|
+
// 6.2 and will render as additional fields on the section, not in this panel.
|
|
221
|
+
//
|
|
222
|
+
// Polling lifecycle (Phase 8.4): polling is driven by the shared usePolling
|
|
223
|
+
// hook. Panel is unmounted by SectionDetail when the user navigates to a
|
|
224
|
+
// different section, which halts the interval. The `isActive` prop is
|
|
225
|
+
// plumbed through so a future layout that keeps panels mounted can gate
|
|
226
|
+
// polling explicitly without another refactor here.
|
|
227
|
+
function OllamaDetectionPanel({ isActive = true }) {
|
|
228
|
+
const { data: status, error } = usePolling(
|
|
229
|
+
'http://127.0.0.1:47592/api/ollama/status',
|
|
230
|
+
2000,
|
|
231
|
+
{ enabled: isActive },
|
|
232
|
+
);
|
|
233
|
+
|
|
234
|
+
if (error) {
|
|
235
|
+
return h(
|
|
236
|
+
Box,
|
|
237
|
+
{ flexDirection: 'column', marginTop: 1 },
|
|
238
|
+
h(Text, { dimColor: true }, 'Ollama detection'),
|
|
239
|
+
h(Text, { color: 'gray' }, ' (serve not running on :47592)'),
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
if (!status) {
|
|
243
|
+
return h(
|
|
244
|
+
Box,
|
|
245
|
+
{ flexDirection: 'column', marginTop: 1 },
|
|
246
|
+
h(Text, { dimColor: true }, 'Ollama detection'),
|
|
247
|
+
h(Text, { color: 'gray' }, ' loading…'),
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
const children = [h(Text, { key: '_label', dimColor: true }, 'Ollama detection')];
|
|
252
|
+
|
|
253
|
+
if (status.enabled === false) {
|
|
254
|
+
children.push(h(Text, { key: '_off', color: 'gray' },
|
|
255
|
+
' (detection disabled — no probe, all downstream surfaces report detected:false)'));
|
|
256
|
+
return h(Box, { flexDirection: 'column', marginTop: 1 }, ...children);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
if (!status.detected) {
|
|
260
|
+
children.push(h(Text, { key: '_none', color: 'gray' },
|
|
261
|
+
` ○ not detected at ${status.host}`));
|
|
262
|
+
if (status.probeError) {
|
|
263
|
+
children.push(h(Text, { key: '_err', dimColor: true },
|
|
264
|
+
` ${status.probeError}`));
|
|
265
|
+
}
|
|
266
|
+
children.push(h(Text, { key: '_hint', dimColor: true },
|
|
267
|
+
' install from https://ollama.com if you want local AI routing'));
|
|
268
|
+
return h(Box, { flexDirection: 'column', marginTop: 1 }, ...children);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
const modelCount = Array.isArray(status.models) ? status.models.length : 0;
|
|
272
|
+
const versionTag = status.version ? ` v${status.version}` : '';
|
|
273
|
+
children.push(h(Text, { key: '_ok', color: 'green' },
|
|
274
|
+
` ✓ detected at ${status.host}${versionTag} — ${modelCount} model(s)`));
|
|
275
|
+
if (Array.isArray(status.models)) {
|
|
276
|
+
for (const m of status.models.slice(0, 12)) {
|
|
277
|
+
const sizeMb = m.size ? ` (${Math.round(m.size / 1024 / 1024)} MB)` : '';
|
|
278
|
+
children.push(h(Text, { key: `_m_${m.name}`, dimColor: true },
|
|
279
|
+
` ${m.name}${sizeMb}`));
|
|
280
|
+
}
|
|
281
|
+
if (modelCount > 12) {
|
|
282
|
+
children.push(h(Text, { key: '_more', dimColor: true },
|
|
283
|
+
` (+${modelCount - 12} more)`));
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
children.push(h(Text, { key: '_test', dimColor: true },
|
|
287
|
+
' test connection: superbased ollama test [--model <name>]'));
|
|
288
|
+
children.push(h(Text, { key: '_phase', dimColor: true },
|
|
289
|
+
' per-call provider="ollama" on AI tools lands in 6.3'));
|
|
290
|
+
return h(Box, { flexDirection: 'column', marginTop: 1 }, ...children);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
// Polls GET /api/watchers/status so users can see which watchers are actively
|
|
294
|
+
// subscribed (from any AI editor). Renders "(serve not running)" if fetch fails.
|
|
295
|
+
function WatcherStatusPanel({ isActive = true }) {
|
|
296
|
+
const { data, error } = usePolling(
|
|
297
|
+
'http://127.0.0.1:47592/api/watchers/status',
|
|
298
|
+
2000,
|
|
299
|
+
{ enabled: isActive },
|
|
300
|
+
);
|
|
301
|
+
const rows = data === null ? null : (Array.isArray(data?.watchers) ? data.watchers : []);
|
|
302
|
+
|
|
303
|
+
if (error) {
|
|
304
|
+
return h(
|
|
305
|
+
Box,
|
|
306
|
+
{ flexDirection: 'column', marginTop: 1 },
|
|
307
|
+
h(Text, { dimColor: true }, 'Active subscriptions'),
|
|
308
|
+
h(Text, { color: 'gray' }, ' (serve not running on :47592)'),
|
|
309
|
+
);
|
|
310
|
+
}
|
|
311
|
+
if (!rows) {
|
|
312
|
+
return h(
|
|
313
|
+
Box,
|
|
314
|
+
{ flexDirection: 'column', marginTop: 1 },
|
|
315
|
+
h(Text, { dimColor: true }, 'Active subscriptions'),
|
|
316
|
+
h(Text, { color: 'gray' }, ' loading…'),
|
|
317
|
+
);
|
|
318
|
+
}
|
|
319
|
+
if (rows.length === 0) {
|
|
320
|
+
return h(
|
|
321
|
+
Box,
|
|
322
|
+
{ flexDirection: 'column', marginTop: 1 },
|
|
323
|
+
h(Text, { dimColor: true }, 'Active subscriptions'),
|
|
324
|
+
h(Text, { color: 'gray' }, ' (none — no MCP client has subscribed)'),
|
|
325
|
+
);
|
|
326
|
+
}
|
|
327
|
+
return h(
|
|
328
|
+
Box,
|
|
329
|
+
{ flexDirection: 'column', marginTop: 1 },
|
|
330
|
+
h(Text, { dimColor: true }, 'Active subscriptions'),
|
|
331
|
+
...rows.map((row) =>
|
|
332
|
+
h(
|
|
333
|
+
Text,
|
|
334
|
+
{ key: row.uri, color: 'green' },
|
|
335
|
+
` ${row.uri} · subscribers: ${row.subscribers}`,
|
|
336
|
+
),
|
|
337
|
+
),
|
|
338
|
+
);
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
// Field detail view — renders one section's fields + highlight + description.
|
|
342
|
+
function SectionDetail({ section, highlightedIndex, values, dirtyPaths }) {
|
|
343
|
+
const visible = visibleFieldsForSection(section);
|
|
344
|
+
const children = [
|
|
345
|
+
h(Text, { key: '_label', bold: true }, section.label),
|
|
346
|
+
h(Text, { key: '_desc', dimColor: true }, section.description),
|
|
347
|
+
h(Text, { key: '_sp', }, ''),
|
|
348
|
+
...visible.map((field, i) => {
|
|
349
|
+
const current = getByPath(values, field.path);
|
|
350
|
+
const marker = i === highlightedIndex ? '▶' : ' ';
|
|
351
|
+
const warning = field.warning ? ' ⚠' : '';
|
|
352
|
+
const restart = field.requiresRestart ? ' ↻' : '';
|
|
353
|
+
const dirty = dirtyPaths.has(field.path) ? ' ·' : '';
|
|
354
|
+
return h(
|
|
355
|
+
Box,
|
|
356
|
+
{ key: field.path, flexDirection: 'column' },
|
|
357
|
+
h(
|
|
358
|
+
Text,
|
|
359
|
+
{ color: i === highlightedIndex ? 'cyan' : undefined },
|
|
360
|
+
`${marker} ${field.label}${warning}${restart}${dirty}`,
|
|
361
|
+
),
|
|
362
|
+
h(
|
|
363
|
+
Text,
|
|
364
|
+
{ color: field.warning ? 'yellow' : 'gray' },
|
|
365
|
+
` ${field.path} = ${formatValue(current)}`,
|
|
366
|
+
),
|
|
367
|
+
);
|
|
368
|
+
}),
|
|
369
|
+
];
|
|
370
|
+
if (section.id === 'watchers') {
|
|
371
|
+
children.push(h(WatcherStatusPanel, { key: '_watcher_status' }));
|
|
372
|
+
}
|
|
373
|
+
if (section.id === 'stt') {
|
|
374
|
+
children.push(h(SpeechModelsPanel, { key: '_speech_models' }));
|
|
375
|
+
}
|
|
376
|
+
if (section.id === 'ollama') {
|
|
377
|
+
children.push(h(OllamaDetectionPanel, { key: '_ollama_detection' }));
|
|
378
|
+
}
|
|
379
|
+
return h(Box, { flexDirection: 'column', paddingLeft: 1, flexGrow: 1 }, ...children);
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
// Status bar — description of the currently highlighted field.
|
|
383
|
+
function StatusBar({ field, message }) {
|
|
384
|
+
if (message) {
|
|
385
|
+
return h(Box, { paddingX: 1 }, h(Text, { color: message.kind === 'error' ? 'red' : 'green' }, message.text));
|
|
386
|
+
}
|
|
387
|
+
if (!field) return h(Box, null, h(Text, null, ''));
|
|
388
|
+
const hint = field.requiresRestart ? ' · restart serve to apply' : '';
|
|
389
|
+
return h(
|
|
390
|
+
Box,
|
|
391
|
+
{ paddingX: 1 },
|
|
392
|
+
h(Text, { dimColor: true }, `${field.description}${hint}`),
|
|
393
|
+
);
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
// Editor — per-field edit flow. Toggles flip immediately; selects/text/number
|
|
397
|
+
// prompt for input. `consent` fields route through the ConsentScreen.
|
|
398
|
+
function Editor({ field, currentValue, onDone, onCancel }) {
|
|
399
|
+
if (field.type === 'toggle') {
|
|
400
|
+
// Render a simple Yes/No select.
|
|
401
|
+
const items = [
|
|
402
|
+
{ label: 'true', value: 'true' },
|
|
403
|
+
{ label: 'false', value: 'false' },
|
|
404
|
+
];
|
|
405
|
+
return h(
|
|
406
|
+
Box,
|
|
407
|
+
{ flexDirection: 'column', paddingX: 1 },
|
|
408
|
+
h(Text, { bold: true }, `Edit ${field.path}`),
|
|
409
|
+
h(Text, { dimColor: true }, field.description),
|
|
410
|
+
h(Text, null, ''),
|
|
411
|
+
h(SelectInput, {
|
|
412
|
+
items,
|
|
413
|
+
initialIndex: currentValue ? 0 : 1,
|
|
414
|
+
onSelect: (item) => onDone(item.value === 'true'),
|
|
415
|
+
}),
|
|
416
|
+
h(Text, { dimColor: true }, 'esc to cancel'),
|
|
417
|
+
);
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
if (field.type === 'select') {
|
|
421
|
+
const items = (field.choices || []).map((c) => ({ label: c.label, value: c.value }));
|
|
422
|
+
const initial = items.findIndex((it) => it.value === currentValue);
|
|
423
|
+
return h(
|
|
424
|
+
Box,
|
|
425
|
+
{ flexDirection: 'column', paddingX: 1 },
|
|
426
|
+
h(Text, { bold: true }, `Edit ${field.path}`),
|
|
427
|
+
h(Text, { dimColor: true }, field.description),
|
|
428
|
+
h(Text, null, ''),
|
|
429
|
+
h(SelectInput, {
|
|
430
|
+
items,
|
|
431
|
+
initialIndex: initial >= 0 ? initial : 0,
|
|
432
|
+
onSelect: (item) => onDone(item.value),
|
|
433
|
+
}),
|
|
434
|
+
h(Text, { dimColor: true }, 'esc to cancel'),
|
|
435
|
+
);
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
if (field.type === 'multiselect') {
|
|
439
|
+
// Simple loop — user presses keys to add/remove from the current value.
|
|
440
|
+
return h(MultiSelectEditor, { field, currentValue, onDone, onCancel });
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
if (field.type === 'text' || field.type === 'shortcut' || field.type === 'path') {
|
|
444
|
+
return h(TextEditor, {
|
|
445
|
+
field,
|
|
446
|
+
initial: typeof currentValue === 'string' ? currentValue : '',
|
|
447
|
+
onDone,
|
|
448
|
+
onCancel,
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
if (field.type === 'number') {
|
|
453
|
+
return h(TextEditor, {
|
|
454
|
+
field,
|
|
455
|
+
initial: currentValue !== undefined ? String(currentValue) : '',
|
|
456
|
+
onDone: (str) => {
|
|
457
|
+
const n = Number(str);
|
|
458
|
+
if (!Number.isFinite(n)) return { error: 'not a number' };
|
|
459
|
+
if (field.min !== undefined && n < field.min) return { error: `minimum is ${field.min}` };
|
|
460
|
+
if (field.max !== undefined && n > field.max) return { error: `maximum is ${field.max}` };
|
|
461
|
+
onDone(n);
|
|
462
|
+
return null;
|
|
463
|
+
},
|
|
464
|
+
onCancel,
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
if (field.type === 'list') {
|
|
469
|
+
return h(TextEditor, {
|
|
470
|
+
field,
|
|
471
|
+
initial: Array.isArray(currentValue) ? currentValue.join(', ') : '',
|
|
472
|
+
onDone: (str) => {
|
|
473
|
+
const parts = str.split(',').map((s) => s.trim()).filter(Boolean);
|
|
474
|
+
onDone(parts);
|
|
475
|
+
return null;
|
|
476
|
+
},
|
|
477
|
+
onCancel,
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
if (field.type === 'consent') {
|
|
482
|
+
return h(ConsentScreen, {
|
|
483
|
+
field,
|
|
484
|
+
currentValue,
|
|
485
|
+
onDone,
|
|
486
|
+
onCancel,
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
return h(Box, null, h(Text, { color: 'red' }, `No editor for type ${field.type}`));
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
function TextEditor({ field, initial, onDone, onCancel }) {
|
|
494
|
+
const [text, setText] = React.useState(initial);
|
|
495
|
+
const [error, setError] = React.useState(null);
|
|
496
|
+
|
|
497
|
+
useInput((input, key) => {
|
|
498
|
+
if (key.escape) onCancel();
|
|
499
|
+
});
|
|
500
|
+
|
|
501
|
+
const submit = (value) => {
|
|
502
|
+
setError(null);
|
|
503
|
+
if (typeof onDone === 'function') {
|
|
504
|
+
const result = onDone(value);
|
|
505
|
+
if (result && result.error) setError(result.error);
|
|
506
|
+
}
|
|
507
|
+
};
|
|
508
|
+
|
|
509
|
+
return h(
|
|
510
|
+
Box,
|
|
511
|
+
{ flexDirection: 'column', paddingX: 1 },
|
|
512
|
+
h(Text, { bold: true }, `Edit ${field.path}`),
|
|
513
|
+
h(Text, { dimColor: true }, field.description),
|
|
514
|
+
h(Text, null, ''),
|
|
515
|
+
h(
|
|
516
|
+
Box,
|
|
517
|
+
null,
|
|
518
|
+
h(Text, null, '> '),
|
|
519
|
+
h(TextInput, {
|
|
520
|
+
value: text,
|
|
521
|
+
onChange: setText,
|
|
522
|
+
onSubmit: (val) => submit(val),
|
|
523
|
+
}),
|
|
524
|
+
),
|
|
525
|
+
error ? h(Text, { color: 'red' }, error) : null,
|
|
526
|
+
h(Text, { dimColor: true }, 'enter to save · esc to cancel'),
|
|
527
|
+
);
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
function MultiSelectEditor({ field, currentValue, onDone, onCancel }) {
|
|
531
|
+
const initial = new Set(Array.isArray(currentValue) ? currentValue : []);
|
|
532
|
+
const [selected, setSelected] = React.useState(initial);
|
|
533
|
+
const [cursor, setCursor] = React.useState(0);
|
|
534
|
+
|
|
535
|
+
const choices = field.choices || [];
|
|
536
|
+
|
|
537
|
+
useInput((input, key) => {
|
|
538
|
+
if (key.escape) onCancel();
|
|
539
|
+
else if (key.upArrow) setCursor((c) => Math.max(0, c - 1));
|
|
540
|
+
else if (key.downArrow) setCursor((c) => Math.min(choices.length - 1, c + 1));
|
|
541
|
+
else if (input === ' ') {
|
|
542
|
+
const value = choices[cursor].value;
|
|
543
|
+
setSelected((prev) => {
|
|
544
|
+
const next = new Set(prev);
|
|
545
|
+
if (next.has(value)) next.delete(value);
|
|
546
|
+
else next.add(value);
|
|
547
|
+
return next;
|
|
548
|
+
});
|
|
549
|
+
} else if (key.return) {
|
|
550
|
+
onDone([...selected]);
|
|
551
|
+
}
|
|
552
|
+
});
|
|
553
|
+
|
|
554
|
+
return h(
|
|
555
|
+
Box,
|
|
556
|
+
{ flexDirection: 'column', paddingX: 1 },
|
|
557
|
+
h(Text, { bold: true }, `Edit ${field.path}`),
|
|
558
|
+
h(Text, { dimColor: true }, field.description),
|
|
559
|
+
h(Text, null, ''),
|
|
560
|
+
...choices.map((c, i) => {
|
|
561
|
+
const mark = selected.has(c.value) ? '✓' : ' ';
|
|
562
|
+
const arrow = i === cursor ? '▶' : ' ';
|
|
563
|
+
return h(Text, { key: c.value, color: i === cursor ? 'cyan' : undefined }, `${arrow} [${mark}] ${c.label}`);
|
|
564
|
+
}),
|
|
565
|
+
h(Text, { dimColor: true }, 'space toggles · enter to save · esc to cancel'),
|
|
566
|
+
);
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
// Consent screen — replaces the normal editor for `consent` fields. Shows a
|
|
570
|
+
// longer explanatory block, the audit log path, and requires typing `I AGREE`
|
|
571
|
+
// before the field flips to `true`. Always requires a second confirmation to
|
|
572
|
+
// flip back to `false` too (symmetry — enabling and disabling are both
|
|
573
|
+
// material decisions for a safety-sensitive feature).
|
|
574
|
+
function ConsentScreen({ field, currentValue, onDone, onCancel }) {
|
|
575
|
+
const enabling = !currentValue;
|
|
576
|
+
const [text, setText] = React.useState('');
|
|
577
|
+
const [error, setError] = React.useState(null);
|
|
578
|
+
|
|
579
|
+
useInput((input, key) => {
|
|
580
|
+
if (key.escape) onCancel();
|
|
581
|
+
});
|
|
582
|
+
|
|
583
|
+
const handleSubmit = (val) => {
|
|
584
|
+
if (val.trim() === 'I AGREE') {
|
|
585
|
+
onDone(enabling ? true : false);
|
|
586
|
+
} else {
|
|
587
|
+
setError('Type "I AGREE" to confirm, or Esc to cancel.');
|
|
588
|
+
}
|
|
589
|
+
};
|
|
590
|
+
|
|
591
|
+
const auditPath = process.env.HOME
|
|
592
|
+
? `${process.env.HOME}/.superbased/audit.log`
|
|
593
|
+
: '~/.superbased/audit.log';
|
|
594
|
+
|
|
595
|
+
return h(
|
|
596
|
+
Box,
|
|
597
|
+
{ flexDirection: 'column', paddingX: 1, borderStyle: 'double', borderColor: 'yellow' },
|
|
598
|
+
h(Text, { bold: true, color: 'yellow' }, `${enabling ? 'Enable' : 'Disable'} ${field.path}`),
|
|
599
|
+
h(Text, null, ''),
|
|
600
|
+
h(Text, null, field.description),
|
|
601
|
+
h(Text, null, ''),
|
|
602
|
+
enabling
|
|
603
|
+
? h(
|
|
604
|
+
Box,
|
|
605
|
+
{ flexDirection: 'column' },
|
|
606
|
+
h(Text, null, 'Turning this on lets MCP tool calls drive your mouse/keyboard.'),
|
|
607
|
+
h(Text, null, 'All attempts are recorded to:'),
|
|
608
|
+
h(Text, { color: 'cyan' }, ` ${auditPath}`),
|
|
609
|
+
h(Text, null, ''),
|
|
610
|
+
h(Text, null, 'Per-action toggles and the protected-apps blocklist still apply.'),
|
|
611
|
+
h(Text, null, 'You can disable everything instantly with "config set guiAutomation.enabled false".'),
|
|
612
|
+
)
|
|
613
|
+
: h(Text, null, 'This will refuse all GUI automation tool calls until re-enabled.'),
|
|
614
|
+
h(Text, null, ''),
|
|
615
|
+
h(Text, null, 'Type "I AGREE" and press Enter to confirm:'),
|
|
616
|
+
h(
|
|
617
|
+
Box,
|
|
618
|
+
null,
|
|
619
|
+
h(Text, null, '> '),
|
|
620
|
+
h(TextInput, { value: text, onChange: setText, onSubmit: handleSubmit }),
|
|
621
|
+
),
|
|
622
|
+
error ? h(Text, { color: 'red' }, error) : null,
|
|
623
|
+
h(Text, { dimColor: true }, 'esc to cancel'),
|
|
624
|
+
);
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
// ── main app ─────────────────────────────────────────────────────────────
|
|
628
|
+
|
|
629
|
+
function SettingsApp() {
|
|
630
|
+
const { exit } = useApp();
|
|
631
|
+
const sections = React.useMemo(visibleSections, []);
|
|
632
|
+
const [sectionIdx, setSectionIdx] = React.useState(0);
|
|
633
|
+
const [mode, setMode] = React.useState('sidebar'); // 'sidebar' | 'detail' | 'edit'
|
|
634
|
+
const [highlightIdx, setHighlightIdx] = React.useState(0);
|
|
635
|
+
const [values, setValues] = React.useState(getAllSettings());
|
|
636
|
+
const [dirtyPaths, setDirtyPaths] = React.useState(new Set());
|
|
637
|
+
const [message, setMessage] = React.useState(null);
|
|
638
|
+
|
|
639
|
+
const currentSection = sections[sectionIdx];
|
|
640
|
+
const visibleFields = currentSection ? visibleFieldsForSection(currentSection) : [];
|
|
641
|
+
const currentField = visibleFields[highlightIdx];
|
|
642
|
+
|
|
643
|
+
useInput((input, key) => {
|
|
644
|
+
if (mode === 'edit') return; // editor handles its own keys
|
|
645
|
+
|
|
646
|
+
// Global keys.
|
|
647
|
+
if (input === 'q' || (mode === 'sidebar' && key.escape)) {
|
|
648
|
+
exit();
|
|
649
|
+
return;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
if (mode === 'detail') {
|
|
653
|
+
if (key.escape) {
|
|
654
|
+
setMode('sidebar');
|
|
655
|
+
setHighlightIdx(0);
|
|
656
|
+
return;
|
|
657
|
+
}
|
|
658
|
+
if (key.upArrow) setHighlightIdx((i) => Math.max(0, i - 1));
|
|
659
|
+
else if (key.downArrow) setHighlightIdx((i) => Math.min(visibleFields.length - 1, i + 1));
|
|
660
|
+
else if (key.return) {
|
|
661
|
+
if (currentField) setMode('edit');
|
|
662
|
+
} else if (input === 'r') {
|
|
663
|
+
// Reset this key to schema default.
|
|
664
|
+
if (currentField) {
|
|
665
|
+
deleteSetting(currentField.path);
|
|
666
|
+
setValues(getAllSettings());
|
|
667
|
+
setDirtyPaths((prev) => {
|
|
668
|
+
const next = new Set(prev);
|
|
669
|
+
next.delete(currentField.path);
|
|
670
|
+
return next;
|
|
671
|
+
});
|
|
672
|
+
setMessage({ kind: 'ok', text: `${currentField.path} reset to default.` });
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
});
|
|
677
|
+
|
|
678
|
+
// Sidebar select → enter section detail.
|
|
679
|
+
const onSidebarSelect = (idx) => {
|
|
680
|
+
setSectionIdx(idx);
|
|
681
|
+
setHighlightIdx(0);
|
|
682
|
+
setMode('detail');
|
|
683
|
+
};
|
|
684
|
+
|
|
685
|
+
// Editor completion — validate + write.
|
|
686
|
+
const onEditorDone = (newValue) => {
|
|
687
|
+
setMessage(null);
|
|
688
|
+
const check = validateValue(currentField, newValue);
|
|
689
|
+
if (!check.ok) {
|
|
690
|
+
setMessage({ kind: 'error', text: `${currentField.path}: ${check.error}` });
|
|
691
|
+
setMode('detail');
|
|
692
|
+
return;
|
|
693
|
+
}
|
|
694
|
+
try {
|
|
695
|
+
setSetting(currentField.path, check.value);
|
|
696
|
+
setValues(getAllSettings());
|
|
697
|
+
setDirtyPaths((prev) => new Set(prev).add(currentField.path));
|
|
698
|
+
const suffix = currentField.requiresRestart ? ' (restart serve to apply)' : '';
|
|
699
|
+
setMessage({ kind: 'ok', text: `${currentField.path} saved${suffix}` });
|
|
700
|
+
} catch (err) {
|
|
701
|
+
setMessage({ kind: 'error', text: `${currentField.path}: ${err instanceof Error ? err.message : String(err)}` });
|
|
702
|
+
}
|
|
703
|
+
setMode('detail');
|
|
704
|
+
};
|
|
705
|
+
|
|
706
|
+
const onEditorCancel = () => setMode('detail');
|
|
707
|
+
|
|
708
|
+
// Layout.
|
|
709
|
+
return h(
|
|
710
|
+
Box,
|
|
711
|
+
{ flexDirection: 'column' },
|
|
712
|
+
h(
|
|
713
|
+
Box,
|
|
714
|
+
{ flexDirection: 'row' },
|
|
715
|
+
h(Sidebar, {
|
|
716
|
+
sections,
|
|
717
|
+
selectedIndex: sectionIdx,
|
|
718
|
+
onSelect: onSidebarSelect,
|
|
719
|
+
}),
|
|
720
|
+
mode === 'edit'
|
|
721
|
+
? h(Editor, {
|
|
722
|
+
field: currentField,
|
|
723
|
+
currentValue: getByPath(values, currentField.path),
|
|
724
|
+
onDone: onEditorDone,
|
|
725
|
+
onCancel: onEditorCancel,
|
|
726
|
+
})
|
|
727
|
+
: h(SectionDetail, {
|
|
728
|
+
section: currentSection,
|
|
729
|
+
highlightedIndex: highlightIdx,
|
|
730
|
+
values,
|
|
731
|
+
dirtyPaths,
|
|
732
|
+
}),
|
|
733
|
+
),
|
|
734
|
+
h(StatusBar, { field: mode === 'detail' ? currentField : null, message }),
|
|
735
|
+
);
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
// ── entry point ──────────────────────────────────────────────────────────
|
|
739
|
+
|
|
740
|
+
export async function startSettingsTui() {
|
|
741
|
+
// Non-TTY fallback handled by caller (plain-dump.ts) before we're invoked.
|
|
742
|
+
const app = render(h(SettingsApp));
|
|
743
|
+
await app.waitUntilExit();
|
|
744
|
+
}
|