Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

feat(ui): install and start Ollama from the provider cards

rubenluetke10-beep5f5d72ce94bc
diff --git a/jarvis/ui/web/frontend/src/components/providers/ProviderTierSection.tsx b/jarvis/ui/web/frontend/src/components/providers/ProviderTierSection.tsx
index cebc6f10d0..df19b5c7ea 100644
--- a/jarvis/ui/web/frontend/src/components/providers/ProviderTierSection.tsx
+++ b/jarvis/ui/web/frontend/src/components/providers/ProviderTierSection.tsx
@@ -1,4 +1,4 @@
-import { useEffect, useMemo, useRef, useState } from "react";
+import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { AlertCircle, Bot, Brain, Check, Copy, Download, HardDrive, Loader2, LogIn, LogOut, Mic, Play, PlugZap, Radio, Sparkles, Square, Terminal, Volume2, Wand2, Waypoints, XCircle } from "lucide-react";
import { AltCredentialNote } from "@/components/AltCredentialNote";
import { ApiKeyForm } from "@/components/ApiKeyForm";
@@ -20,7 +20,12 @@ import {
managedServerStatus,
managedServerStop,
managedServerUninstall,
+ ollamaRuntime,
+ ollamaRuntimeInstall,
+ ollamaRuntimeStart,
type ManagedServerRuntime,
+ type OllamaRuntimeInstallProgress,
+ type OllamaRuntimeStatus,
modelPullStatus,
pullableModels,
startLocalInstall,
@@ -2201,13 +2206,26 @@ function ManagedServerPanel({
)}
{!status.ready && !running && preflight && !preflight.ok && (
- <div className="space-y-1 text-xs">
+ <div className="space-y-2 text-xs">
<p className="text-amber-500">{preflight.blocker}</p>
<ul className="list-disc space-y-0.5 pl-4 text-muted-foreground">
{preflight.actions.map((action) => (
<li key={action}>{action}</li>
))}
</ul>
+ {/* A blocked BRAIN is fixable right here: the local brain is
+ Ollama by design, so offer its install/start instead of only
+ printing the terminal command. Re-runs the preflight once the
+ runtime comes up. */}
+ {preflight.brain?.kind === "blocked" && (
+ <OllamaRuntimePanel
+ providerId="ollama"
+ onChanged={() => {
+ void check();
+ onChanged();
+ }}
+ />
+ )}
</div>
)}
@@ -2249,6 +2267,162 @@ function ManagedServerPanel({
);
}
+/**
+ * Install or start the Ollama runtime itself — the last terminal step on the
+ * local-model path. Invisible while Ollama runs (nothing to do); when it is
+ * stopped it offers Start, when it is absent it offers a confirmed Install
+ * (official ollama.com artifacts only, backend-authored status sentences
+ * rendered verbatim). Mounted on pull-capable cards and inside the managed
+ * realtime card's blocked-brain state.
+ */
+function OllamaRuntimePanel({
+ providerId,
+ onChanged,
+}: {
+ /** The pull-capable card whose runtime routes this panel drives. */
+ providerId: string;
+ onChanged: () => void;
+}) {
+ const t = useT();
+ const [status, setStatus] = useState<OllamaRuntimeStatus | null>(null);
+ const [progress, setProgress] = useState<OllamaRuntimeInstallProgress | null>(
+ null,
+ );
+ const [confirmInstall, setConfirmInstall] = useState(false);
+ const [busy, setBusy] = useState(false);
+ const [error, setError] = useState<string | null>(null);
+ const installing = Boolean(progress?.running);
+
+ const refresh = useCallback(async () => {
+ try {
+ const next = await ollamaRuntime(providerId);
+ // A mocked/older backend may answer with a partial body — treat any
+ // missing half as "no data" instead of crashing the whole card.
+ if (!next.status || !next.install) return null;
+ setStatus(next.status);
+ setProgress(next.install);
+ return next;
+ } catch {
+ return null;
+ }
+ }, [providerId]);
+
+ useEffect(() => {
+ void refresh();
+ }, [refresh]);
+
+ useEffect(() => {
+ if (!installing) return;
+ let cancelled = false;
+ const timer = window.setInterval(async () => {
+ const next = await refresh();
+ if (cancelled || next === null) return;
+ if (!next.install.running) {
+ window.clearInterval(timer);
+ if (next.install.phase === "error") {
+ setError(next.install.error || "install failed");
+ }
+ onChanged();
+ }
+ }, 3000);
+ return () => {
+ cancelled = true;
+ window.clearInterval(timer);
+ };
+ }, [installing, refresh, onChanged]);
+
+ const install = async () => {
+ if (!confirmInstall) {
+ setConfirmInstall(true);
+ return;
+ }
+ setConfirmInstall(false);
+ setError(null);
+ try {
+ const first = await ollamaRuntimeInstall(providerId);
+ setProgress(first);
+ if (!first.running && first.phase === "error" && first.error) {
+ setError(first.error);
+ }
+ } catch (err) {
+ setError(err instanceof Error ? err.message : String(err));
+ }
+ };
+
+ const start = async () => {
+ setError(null);
+ setBusy(true);
+ try {
+ const next = await ollamaRuntimeStart(providerId);
+ if (next) setStatus(next);
+ onChanged();
+ } catch (err) {
+ setError(err instanceof Error ? err.message : String(err));
+ } finally {
+ setBusy(false);
+ }
+ };
+
+ if (status === null) return null;
+ if (status.running && !installing) return null; // healthy — stay out of the way
+
+ return (
+ <div
+ className="space-y-2 rounded-md border border-border/60 bg-muted/30 p-3"
+ data-testid="ollama-runtime-panel"
+ >
+ <div className="flex items-start gap-2 text-xs">
+ <AlertCircle className="mt-0.5 h-3.5 w-3.5 shrink-0 text-amber-500" />
+ <span className="text-muted-foreground">
+ {installing ? (progress?.detail ?? status.detail) : status.detail}
+ </span>
+ </div>
+
+ {installing && (
+ <div className="h-1.5 w-full overflow-hidden rounded bg-muted">
+ <div
+ className="h-full rounded bg-primary transition-all"
+ style={{ width: `${Math.max(2, progress?.percent ?? 0)}%` }}
+ />
+ </div>
+ )}
+
+ {!installing && !status.installed && (
+ <div className="space-y-1">
+ <Button size="sm" onClick={install} className="gap-2">
+ <Download className="h-3.5 w-3.5" />
+ {confirmInstall
+ ? t("apikeys_view.ollama_install_confirm")
+ : t("apikeys_view.ollama_install_cta")}
+ </Button>
+ <p className="text-[11px] text-muted-foreground">
+ {t("apikeys_view.ollama_install_hint")}
+ </p>
+ </div>
+ )}
+
+ {!installing && status.installed && !status.running && (
+ <Button
+ size="sm"
+ variant="secondary"
+ onClick={start}
+ disabled={busy}
+ className="gap-2"
+ >
+ {busy ? (
+ <Loader2 className="h-3.5 w-3.5 animate-spin" />
+ ) : (
+ <Play className="h-3.5 w-3.5" />
+ )}
+ {t("apikeys_view.ollama_start_cta")}
+ </Button>
+ )}
+
+ {error && <p className="text-[11px] text-destructive">{error}</p>}
+ </div>
+ );
+}
+
/**
* The download half of a keyless local brain card: which models this machine
* could run, which it already has, and the one button that fetches one.
@@ -2561,6 +2735,11 @@ export function AuthWidget({
{descriptor.supports_base_url && (
<BaseUrlField descriptor={descriptor} onChanged={onChanged} />
)}
+ {/* The runtime itself comes before the model list: pull buttons are
+ dead while Ollama is absent or stopped, and this panel is the fix. */}
+ {descriptor.supports_model_pull && (
+ <OllamaRuntimePanel providerId={descriptor.id} onChanged={onChanged} />
+ )}
<LocalModelDownloadPanel descriptor={descriptor} onChanged={onChanged} />
{/* Ordered after the server URL on purpose: a download can only be
offered once the card points at the right server. */}
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.json
index 9b2ed00045..a54d3dd42d 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json
@@ -1180,6 +1180,10 @@
"managed_server_port_conflict": "Ein anderer Prozess belegt diesen Port",
"managed_start_cta": "Server starten",
"managed_stop_cta": "Server stoppen",
+ "ollama_install_cta": "Ollama installieren",
+ "ollama_install_confirm": "Erneut klicken, um Ollama jetzt zu installieren",
+ "ollama_install_hint": "Lädt die offizielle Ollama-Laufzeit von ollama.com und startet sie — ganz ohne Terminal. Lokale Modelle laufen vollständig auf diesem Rechner.",
+ "ollama_start_cta": "Ollama starten",
"managed_brain_recheck": "Aktuelles Denkmodell übernehmen",
"managed_brain_recheck_hint": "Prüft neu, welches Ollama-Modell auf diese Maschine passt, und stellt das Server-Gehirn darauf um — ohne Neuinstallation. Gilt ab dem nächsten Server-Start.",
"shared_delete_prefix": "Dieser Schlüssel wird auch verwendet von:",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.json
index cc000a794c..03e36dcd7c 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json
@@ -1180,6 +1180,10 @@
"managed_server_port_conflict": "Another process is serving this port",
"managed_start_cta": "Start server",
"managed_stop_cta": "Stop server",
+ "ollama_install_cta": "Install Ollama",
+ "ollama_install_confirm": "Click again to install Ollama now",
+ "ollama_install_hint": "Downloads the official Ollama runtime from ollama.com and starts it — no terminal needed. Local models run entirely on this machine.",
+ "ollama_start_cta": "Start Ollama",
"managed_brain_recheck": "Use current brain model",
"managed_brain_recheck_hint": "Re-check which Ollama model fits this machine and switch the server's brain to it — no reinstall. Takes effect on the next server start.",
"shared_delete_prefix": "This key is also used by:",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.json
index 18a9071dfd..708aa76306 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json
@@ -1180,6 +1180,10 @@
"managed_server_port_conflict": "Otro proceso está sirviendo en este puerto",
"managed_start_cta": "Iniciar servidor",
"managed_stop_cta": "Detener servidor",
+ "ollama_install_cta": "Instalar Ollama",
+ "ollama_install_confirm": "Haz clic de nuevo para instalar Ollama ahora",
+ "ollama_install_hint": "Descarga el runtime oficial de Ollama desde ollama.com y lo inicia — sin terminal. Los modelos locales se ejecutan por completo en esta máquina.",
+ "ollama_start_cta": "Iniciar Ollama",
"managed_brain_recheck": "Usar el modelo de razonamiento actual",
"managed_brain_recheck_hint": "Vuelve a comprobar qué modelo de Ollama cabe en esta máquina y cambia el cerebro del servidor a él — sin reinstalar. Se aplica en el próximo arranque del servidor.",
"shared_delete_prefix": "Esta clave también la usan:",