otherwise-cli 0.1.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.
Files changed (81) hide show
  1. package/README.md +193 -0
  2. package/bin/otherwise.js +5 -0
  3. package/frontend/404.html +84 -0
  4. package/frontend/assets/OpenDyslexic3-Bold-CDyRs55Y.ttf +0 -0
  5. package/frontend/assets/OpenDyslexic3-Regular-CIBXa4WE.ttf +0 -0
  6. package/frontend/assets/__vite-browser-external-BIHI7g3E.js +1 -0
  7. package/frontend/assets/conversational-worker-CeKiciGk.js +2929 -0
  8. package/frontend/assets/dictation-worker-D0aYfq8b.js +29 -0
  9. package/frontend/assets/gemini-color-CgSQmmva.png +0 -0
  10. package/frontend/assets/index-BLux5ps4.js +21 -0
  11. package/frontend/assets/index-Blh8_TEM.js +5272 -0
  12. package/frontend/assets/index-BpQ1PuKu.js +18 -0
  13. package/frontend/assets/index-Df737c8w.css +1 -0
  14. package/frontend/assets/index-xaYHL6wb.js +113 -0
  15. package/frontend/assets/ort-wasm-simd-threaded.asyncify-BynIiDiv.wasm +0 -0
  16. package/frontend/assets/ort-wasm-simd-threaded.jsep-B0T3yYHD.wasm +0 -0
  17. package/frontend/assets/transformers-tULNc5V3.js +31 -0
  18. package/frontend/assets/tts-worker-DPJWqT7N.js +2899 -0
  19. package/frontend/assets/voice-mode-worker-GzvIE_uh.js +2927 -0
  20. package/frontend/assets/worker-2d5ABSLU.js +31 -0
  21. package/frontend/banner.png +0 -0
  22. package/frontend/favicon.svg +3 -0
  23. package/frontend/google55e5ec47ee14a5f8.html +1 -0
  24. package/frontend/index.html +234 -0
  25. package/frontend/manifest.json +17 -0
  26. package/frontend/pdf.worker.min.mjs +21 -0
  27. package/frontend/robots.txt +5 -0
  28. package/frontend/sitemap.xml +27 -0
  29. package/package.json +81 -0
  30. package/src/agent/index.js +1066 -0
  31. package/src/agent/location.js +51 -0
  32. package/src/agent/prompt.js +548 -0
  33. package/src/agent/tools.js +4372 -0
  34. package/src/browser/detect.js +68 -0
  35. package/src/browser/session.js +1109 -0
  36. package/src/config.js +137 -0
  37. package/src/email/client.js +503 -0
  38. package/src/index.js +557 -0
  39. package/src/inference/anthropic.js +113 -0
  40. package/src/inference/google.js +373 -0
  41. package/src/inference/index.js +81 -0
  42. package/src/inference/ollama.js +383 -0
  43. package/src/inference/openai.js +140 -0
  44. package/src/inference/openrouter.js +378 -0
  45. package/src/inference/xai.js +200 -0
  46. package/src/logBridge.js +9 -0
  47. package/src/models.js +146 -0
  48. package/src/remote/client.js +225 -0
  49. package/src/scheduler/cron.js +243 -0
  50. package/src/server.js +3876 -0
  51. package/src/storage/db.js +1135 -0
  52. package/src/storage/supabase.js +364 -0
  53. package/src/tunnel/cloudflare.js +241 -0
  54. package/src/ui/components/App.jsx +687 -0
  55. package/src/ui/components/BrowserSelect.jsx +111 -0
  56. package/src/ui/components/FilePicker.jsx +472 -0
  57. package/src/ui/components/Header.jsx +444 -0
  58. package/src/ui/components/HelpPanel.jsx +173 -0
  59. package/src/ui/components/HistoryPanel.jsx +158 -0
  60. package/src/ui/components/MessageList.jsx +235 -0
  61. package/src/ui/components/ModelSelector.jsx +304 -0
  62. package/src/ui/components/PromptInput.jsx +515 -0
  63. package/src/ui/components/StreamingResponse.jsx +134 -0
  64. package/src/ui/components/ThinkingIndicator.jsx +365 -0
  65. package/src/ui/components/ToolExecution.jsx +714 -0
  66. package/src/ui/components/index.js +82 -0
  67. package/src/ui/context/TerminalContext.jsx +150 -0
  68. package/src/ui/context/index.js +13 -0
  69. package/src/ui/hooks/index.js +16 -0
  70. package/src/ui/hooks/useChatState.js +675 -0
  71. package/src/ui/hooks/useCommands.js +280 -0
  72. package/src/ui/hooks/useFileAttachments.js +216 -0
  73. package/src/ui/hooks/useKeyboardShortcuts.js +173 -0
  74. package/src/ui/hooks/useNotifications.js +185 -0
  75. package/src/ui/hooks/useTerminalSize.js +151 -0
  76. package/src/ui/hooks/useWebSocket.js +273 -0
  77. package/src/ui/index.js +94 -0
  78. package/src/ui/ink-runner.js +22 -0
  79. package/src/ui/utils/formatters.js +424 -0
  80. package/src/ui/utils/index.js +6 -0
  81. package/src/ui/utils/markdown.js +166 -0
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Detect available browsers for Playwright automation.
3
+ * Returns a list of browser options (channel or executablePath) that can be used with chromium.launch().
4
+ * Playwright's chromium can use channel: 'chrome' | 'msedge' | 'chromium' (bundled).
5
+ */
6
+
7
+ import { existsSync } from 'fs';
8
+ import { platform } from 'os';
9
+
10
+ /** Known browser options in order of preference (system default first). */
11
+ const BROWSER_OPTIONS = [
12
+ { id: 'chrome', name: 'Google Chrome', channel: 'chrome' },
13
+ { id: 'msedge', name: 'Microsoft Edge', channel: 'msedge' },
14
+ { id: 'chromium', name: 'Chromium (bundled)', channel: 'chromium' },
15
+ ];
16
+
17
+ /** Platform-specific paths to check for browser executables (for availability hint). */
18
+ const EXECUTABLE_PATHS = {
19
+ darwin: {
20
+ chrome: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
21
+ msedge: '/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge',
22
+ },
23
+ win32: {
24
+ chrome: process.env.LOCALAPPDATA
25
+ ? `${process.env.LOCALAPPDATA}\\Google\\Chrome\\Application\\chrome.exe`
26
+ : 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe',
27
+ msedge: 'C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe',
28
+ },
29
+ linux: {
30
+ chrome: '/usr/bin/google-chrome',
31
+ msedge: '/usr/bin/microsoft-edge',
32
+ },
33
+ };
34
+
35
+ /**
36
+ * Check if a browser executable exists on the system (best-effort).
37
+ * @param {string} id - 'chrome' | 'msedge'
38
+ * @returns {boolean}
39
+ */
40
+ function isExecutableAvailable(id) {
41
+ const plat = platform();
42
+ const paths = EXECUTABLE_PATHS[plat];
43
+ if (!paths || !paths[id]) return false;
44
+ try {
45
+ return existsSync(paths[id]);
46
+ } catch {
47
+ return false;
48
+ }
49
+ }
50
+
51
+ /**
52
+ * Return list of browser options, with an optional `available` flag where we can detect installation.
53
+ * Chromium (bundled) is always considered available.
54
+ * @returns {{ id: string, name: string, channel: string, available?: boolean }[]}
55
+ */
56
+ export function getAvailableBrowsers() {
57
+ return BROWSER_OPTIONS.map((opt) => {
58
+ if (opt.id === 'chromium') {
59
+ return { ...opt, available: true };
60
+ }
61
+ return {
62
+ ...opt,
63
+ available: isExecutableAvailable(opt.id),
64
+ };
65
+ });
66
+ }
67
+
68
+ export default { getAvailableBrowsers };