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.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
feat(local-models): the setup assistant runs on the user's Tool Model — the pick made once under API Keys, billed through that key; the Agents chain is only the fallback
rubenluetke10-beep5e9e4793adbb
diff --git a/jarvis/local_models/assistant_prompt.py b/jarvis/local_models/assistant_prompt.pyindex 85d25164fe..fd6e182a66 100644--- a/jarvis/local_models/assistant_prompt.py+++ b/jarvis/local_models/assistant_prompt.py@@ -204,7 +204,7 @@ def _render_machine(machine: dict[str, Any], server: dict[str, Any], root: str)),f"- Active brain provider: {machine['active_brain'] or 'unset'} ""(only the person may change it)",- f"- You run on the Agents tier: {machine['assistant_tier'] or 'unknown'}",+ f"- You run on the Tool Model (billed through its key): {machine['assistant_tier'] or 'unknown'}",]return "\n".join(lines)diff --git a/jarvis/local_models/assistant_session.py b/jarvis/local_models/assistant_session.pyindex 4d5aea5c65..587b9ef8d4 100644--- a/jarvis/local_models/assistant_session.py+++ b/jarvis/local_models/assistant_session.py@@ -30,14 +30,17 @@ __all__ = []SURFACE: Final[str] = "local-models"-NOT_READY: Final[str] = "Connect the Jarvis Agents tier first — the setup assistant runs on it."+NOT_READY: Final[str] = (+ "Pick a Tool Model with an API key first (API Keys → Tool Model) — the setup "+ "assistant runs on it, billed through that key."+)#: The tier is connected but every provider in its chain drives a vendor CLI#: on a flat prompt (Antigravity, for one) and cannot call the assistant's#: tools; a fallback with an API key fixes it.NO_TOOLS: Final[str] = (- "The Jarvis Agents tier cannot call tools here (a CLI-only provider such as "- "Antigravity). Set a tool-capable fallback with an API key — Gemini, OpenAI "- "or OpenRouter — on the Agents tier and try again."+ "The picked Tool Model cannot call tools here (a CLI-only provider such as "+ "Antigravity). Pick an API provider — Gemini, OpenAI, Vertex or OpenRouter — "+ "under API Keys → Tool Model and try again.")@@ -85,30 +88,64 @@ def _tool_capable(provider: str) -> bool:def _default_usable(provider: str) -> bool:+ """A credential exists: the provider's own key (the Tool Model bills+ through it) or the Agents-tier secret for the fallback chain."""from jarvis.core.config import get_jarvis_agent_secrettry:- return bool(get_jarvis_agent_secret(provider))+ if get_jarvis_agent_secret(provider):+ return Trueexcept Exception: # noqa: BLE001 — no credential readable counts as nonelog.debug("agents tier: credential lookup for %s failed", provider, exc_info=True)+ try:+ from jarvis.brain.app_control import is_credential_present+ from jarvis.ui.web.provider_spec import get_spec++ spec = get_spec(provider)+ return spec is not None and bool(is_credential_present(spec))+ except Exception: # noqa: BLE001 — same: unreadable is "none"+ log.debug("agents tier: main credential lookup for %s failed", provider, exc_info=True)return False+def _tool_model_pair(cfg: Any) -> tuple[str, str] | None:+ """The user's Tool Model pick, ``None`` when it is ``auto``.++ The same reader the Tool Model tab and the IDE's prompt writer use+ (``resolver._tool_model_selection``), so the assistant runs on exactly the+ model the user pointed that tab at — and is billed through that key.+ """+ from jarvis.brain.resolver import _tool_model_selection++ try:+ provider, model = _tool_model_selection(cfg)+ except Exception: # noqa: BLE001 — a malformed section reads as unset, logged+ log.debug("agents tier: tool-model selection unreadable", exc_info=True)+ return None+ if not provider or provider == "auto":+ return None+ return provider, str(model or "").strip()++def _chain(cfg: Any) -> list[tuple[str, str]]:+ """The Tool Model first; the Agents-tier chain only as a fallback."""+ out: list[tuple[str, str]] = []+ pinned = _tool_model_pair(cfg)+ if pinned is not None:+ out.append(pinned)brain = getattr(cfg, "brain", None)worker = getattr(brain, "worker", None)if worker is None:- return []+ return outpairs = [("provider", "model"),("fallback_provider", "fallback_model"),("fallback_provider_2", "fallback_model_2"),]- out: list[tuple[str, str]] = []for p_key, m_key in pairs:provider = str(getattr(worker, p_key, "") or "").strip()model = str(getattr(worker, m_key, "") or "").strip()- if provider:+ if provider and (provider, model) not in out:out.append((provider, model))return outdiff --git a/jarvis/ui/web/frontend/src/components/local-models/AssistantPanel.tsx b/jarvis/ui/web/frontend/src/components/local-models/AssistantPanel.tsxindex da5749a080..ed73506abd 100644--- a/jarvis/ui/web/frontend/src/components/local-models/AssistantPanel.tsx+++ b/jarvis/ui/web/frontend/src/components/local-models/AssistantPanel.tsx@@ -16,7 +16,7 @@* asks (AP-3) — the panel only answers what was already confirmed; anything* else keeps its ordinary card.*- * Honest states, never toasts: a 409 from `/run` means the Jarvis Agents tier+ * Honest states, never toasts: a 409 from `/run` means the Tool Model (or its Agents-tier fallback)* is not usable and the sentence links to API Keys; a 404 means the backend* predates the assistant. The header carries the monitor's last check with a* "Fix" that opens diagnose mode.@@ -114,7 +114,7 @@ export function AssistantPanel({const [health, setHealth] = useState<AssistantHealth | null>(null);const [starting, setStarting] = useState<AssistantMode | null>(null);- /** The 409 sentence: the Agents tier is not usable. */+ /** The 409 sentence: no usable Tool Model or Agents-tier fallback. */const [blocked, setBlocked] = useState<string | null>(null);/** 404 from the assistant routes: the running backend predates this panel. */const [backendMissing, setBackendMissing] = useState(false);diff --git a/tests/unit/local_models/test_assistant_session.py b/tests/unit/local_models/test_assistant_session.pyindex c28136c3f8..f4fbffad37 100644--- a/tests/unit/local_models/test_assistant_session.py+++ b/tests/unit/local_models/test_assistant_session.py@@ -6,7 +6,7 @@ import pytestfrom jarvis.agent_chat.service import AgentChatServicefrom jarvis.agent_chat.store import AgentChatStore-from jarvis.core.config import BrainTierConfig, JarvisConfig+from jarvis.core.config import BrainProviderConfig, BrainTierConfig, JarvisConfigfrom jarvis.local_models import assistant_session as policy@@ -74,7 +74,7 @@ def test_ensure_session_creates_once_and_recreates_when_the_tier_moves() -> Nonedef test_ensure_session_refuses_without_the_tier() -> None:svc = _svc()- with pytest.raises(PermissionError, match="Connect the Jarvis Agents tier first"):+ with pytest.raises(PermissionError, match="Pick a Tool Model with an API key first"):policy.ensure_session(svc, _cfg(), usable=lambda _p: False)assert svc.store.list_sessions(surface="local-models") == []@@ -124,7 +124,26 @@ async def test_probe_live_classifies_with_the_provider_test_and_caches() -> Nonecfg = _cfg("gemini", "g-pro", fallback_provider="openai", fallback_model="o-1")pairs = policy.chain_candidates(cfg, usable=lambda _p: True, tool_capable=lambda _p: True)out = await policy.probe_live(cfg, pairs, tester=_tester)- assert out[("gemini", "g-pro")] == (False, "gemini (g-pro): the account has no credit or quota left for this model.")+ assert out[("gemini", "g-pro")] == (+ False,+ "gemini (g-pro): the account has no credit or quota left for this model.",+ )assert out[("openai", "o-1")] == (True, "")again = await policy.probe_live(cfg, pairs, tester=_tester)assert again == out and len(calls) == 2 # cached, no second real call+++def test_the_tool_model_comes_first_and_the_agents_chain_is_the_fallback() -> None:+ """The user answers "which model does my own work" once, in the Tool+ Model tab; the assistant honours that pick and bills through its key."""+ cfg = _cfg("openai", "gpt-x")+ cfg.brain.tool_model = BrainTierConfig(provider="vertex")+ cfg.brain.providers["vertex"] = BrainProviderConfig(tool_model="gemini-3.6-flash")+ assert policy._chain(cfg)[0] == ("vertex", "gemini-3.6-flash")+ tier = policy.agents_tier(cfg, usable=lambda _p: True, tool_capable=lambda _p: True)+ assert (tier.provider, tier.model) == ("vertex", "gemini-3.6-flash")+ # An unusable Tool Model falls back to the Agents chain, honestly.+ tier = policy.agents_tier(cfg, usable=lambda p: p != "vertex", tool_capable=lambda _p: True)+ assert (tier.provider, tier.model) == ("openai", "gpt-x")+ cfg.brain.tool_model = BrainTierConfig(provider="auto")+ assert policy._chain(cfg)[0] == ("openai", "gpt-x")