// Single source of truth for "this feature only exists on some platforms" — // mirrors the same-named module in vncmail-native (mobile), so the AI // Assistant capability contract (docs/AI-ASSISTANT-CONCEPT.md §3, §11) // reads identically across both clients. import { isElectronShell } from '@/lib/electron-bridge'; /** * The `local` provider class (a loopback Ollama-compatible runtime) needs a * host process reachable on 127.0.0.1. Electron's main process can fetch * loopback directly, no CORS constraint. A browser page can too — localhost * is a trustworthy origin so mixed-content doesn't block it — but only if * the runtime's own CORS allowlist permits this origin (see * localLlmNeedsCorsSetup below). Mobile has neither the runtime nor the RAM * and is a separate codebase (vncmail-native), not reachable from here. */ export function supportsLocalLlm(): boolean { return true; // web or Electron — this codebase is never mobile } /** * True only for the plain-browser case: Electron reaches loopback from its * main process with no CORS involved at all, so this is specifically the * "advise the user to set OLLAMA_ORIGINS" case (docs/AI-ASSISTANT-CONCEPT.md * §3's note under the platform matrix), not a general capability check. */ export function localLlmNeedsCorsSetup(): boolean { return !isElectronShell(); }