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(web-api): update outputs, provider & server routes

Ruben Lütke54cb25919983
diff --git a/jarvis/ui/web/outputs_routes.py b/jarvis/ui/web/outputs_routes.py
index 2a51d4b753..c0d4b9f342 100644
--- a/jarvis/ui/web/outputs_routes.py
+++ b/jarvis/ui/web/outputs_routes.py
@@ -54,18 +54,20 @@ _MISSION_DIR_RE = re.compile(r"^mission_(?P<short>[0-9a-f-]{6,40})$")
def _outputs_root(request: Request) -> Path:
- """Resolve the sub-agents-outputs directory.
+ """Resolve the mission outputs directory.
Bootstrap stashed the path on `app.state.outputs_root` in
`_init_mission_stack` (see `server.py:_init_mission_stack`). Falls back to
- `<repo_parent>/sub-agents-outputs` when missing (defensive — same default
- the bootstrap uses).
+ the resolver (prefers ``jarvis-agent-outputs/``, falls back to legacy
+ ``sub-agents-outputs/`` if only that exists) when the stashed path is absent.
"""
cached = getattr(request.app.state, "outputs_root", None)
if cached is not None:
return Path(cached)
+ from jarvis.missions.isolation.worktree import resolve_outputs_root
here = Path(__file__).resolve()
- return here.parent.parent.parent.parent / "sub-agents-outputs"
+ repo_root = here.parent.parent.parent.parent
+ return resolve_outputs_root(repo_root)
def _parse_slug(name: str) -> dict[str, Any]:
diff --git a/jarvis/ui/web/provider_routes.py b/jarvis/ui/web/provider_routes.py
index a64ba5b63a..41154ed891 100644
--- a/jarvis/ui/web/provider_routes.py
+++ b/jarvis/ui/web/provider_routes.py
@@ -373,7 +373,7 @@ def _codex_binary_path(request: Request | None = None) -> str | None:
def _apply_worker_in_memory(request: Request, provider: str) -> None:
- """Best-effort in-memory update of ``cfg.brain.sub_jarvis.provider``.
+ """Best-effort in-memory update of ``cfg.brain.worker.provider``.
So the next ``/jarvis-agent/status`` reflects the choice immediately (the
worker itself only re-reads at restart). Frozen / detached cfg is not an error.
@@ -381,40 +381,40 @@ def _apply_worker_in_memory(request: Request, provider: str) -> None:
cfg = _resolve_cfg(request)
if cfg is None or getattr(cfg, "brain", None) is None:
return
- sub = getattr(cfg.brain, "sub_jarvis", None)
+ sub = getattr(cfg.brain, "worker", None)
try:
if sub is None:
from jarvis.core.config import BrainTierConfig
- cfg.brain.sub_jarvis = BrainTierConfig(provider=provider)
+ cfg.brain.worker = BrainTierConfig(provider=provider)
else:
sub.provider = provider
except Exception as exc: # noqa: BLE001 — frozen models / detached cfg are not errors
- log.debug("In-memory sub_jarvis.provider update skipped: %s", exc)
+ log.debug("In-memory worker.provider update skipped: %s", exc)
def _apply_worker_model_in_memory(request: Request, model: str) -> None:
- """Best-effort in-memory update of ``cfg.brain.sub_jarvis.model``.
+ """Best-effort in-memory update of ``cfg.brain.worker.model``.
- Mirrors :func:`_apply_worker_in_memory`; a missing ``sub_jarvis``
+ Mirrors :func:`_apply_worker_in_memory`; a missing ``worker``
block is created with the router primary as provider so the override is
never silently dropped.
"""
cfg = _resolve_cfg(request)
if cfg is None or getattr(cfg, "brain", None) is None:
return
- sub = getattr(cfg.brain, "sub_jarvis", None)
+ sub = getattr(cfg.brain, "worker", None)
try:
if sub is None:
from jarvis.core.config import BrainTierConfig
- cfg.brain.sub_jarvis = BrainTierConfig(
+ cfg.brain.worker = BrainTierConfig(
provider=getattr(cfg.brain, "primary", "") or "", model=model,
)
else:
sub.model = model
except Exception as exc: # noqa: BLE001 — frozen models / detached cfg are not errors
- log.debug("In-memory sub_jarvis.model update skipped: %s", exc)
+ log.debug("In-memory worker.model update skipped: %s", exc)
async def _emit(request: Request, event: Any) -> None:
@@ -622,7 +622,7 @@ def _jarvis_agent_section_health(cfg: Any) -> SectionHealth:
reason="no_active",
detail="No subagent worker selected",
)
- sub = getattr(brain, "sub_jarvis", None)
+ sub = getattr(brain, "worker", None)
provider = (getattr(sub, "provider", None) if sub else None) or getattr(
brain, "primary", None
)
@@ -1584,9 +1584,9 @@ async def jarvis_agent_switch(body: SwitchBody, request: Request) -> dict[str, A
persisted = False
if body.persist:
try:
- from jarvis.core.config_writer import set_sub_jarvis_provider
+ from jarvis.core.config_writer import set_worker_provider
- set_sub_jarvis_provider(_CODEX_SUBAGENT_CANONICAL)
+ set_worker_provider(_CODEX_SUBAGENT_CANONICAL)
persisted = True
except FileNotFoundError as exc:
raise HTTPException(status_code=500, detail=str(exc)) from exc
@@ -1595,7 +1595,7 @@ async def jarvis_agent_switch(body: SwitchBody, request: Request) -> dict[str, A
status_code=500, detail=f"TOML-Write fehlgeschlagen: {exc}"
) from exc
_apply_worker_in_memory(request, _CODEX_SUBAGENT_CANONICAL)
- await _emit(request, SecretConfigured(key="brain.sub_jarvis.provider", action="set"))
+ await _emit(request, SecretConfigured(key="brain.worker.provider", action="set"))
return {
"ok": True,
"active": _CODEX_SUBAGENT_CANONICAL,
@@ -1632,9 +1632,9 @@ async def jarvis_agent_switch(body: SwitchBody, request: Request) -> dict[str, A
persisted = False
if body.persist:
try:
- from jarvis.core.config_writer import set_sub_jarvis_provider
+ from jarvis.core.config_writer import set_worker_provider
- set_sub_jarvis_provider(ANTIGRAVITY_SUBAGENT_CANONICAL)
+ set_worker_provider(ANTIGRAVITY_SUBAGENT_CANONICAL)
persisted = True
except FileNotFoundError as exc:
raise HTTPException(status_code=500, detail=str(exc)) from exc
@@ -1643,7 +1643,7 @@ async def jarvis_agent_switch(body: SwitchBody, request: Request) -> dict[str, A
status_code=500, detail=f"TOML-Write fehlgeschlagen: {exc}"
) from exc
_apply_worker_in_memory(request, ANTIGRAVITY_SUBAGENT_CANONICAL)
- await _emit(request, SecretConfigured(key="brain.sub_jarvis.provider", action="set"))
+ await _emit(request, SecretConfigured(key="brain.worker.provider", action="set"))
return {
"ok": True,
"active": ANTIGRAVITY_SUBAGENT_CANONICAL,
@@ -1687,9 +1687,9 @@ async def jarvis_agent_switch(body: SwitchBody, request: Request) -> dict[str, A
persisted = False
if body.persist:
try:
- from jarvis.core.config_writer import set_sub_jarvis_provider
+ from jarvis.core.config_writer import set_worker_provider
- set_sub_jarvis_provider(provider)
+ set_worker_provider(provider)
persisted = True
except FileNotFoundError as exc:
raise HTTPException(status_code=500, detail=str(exc)) from exc
@@ -1702,7 +1702,7 @@ async def jarvis_agent_switch(body: SwitchBody, request: Request) -> dict[str, A
# choice immediately (the worker itself only re-reads on restart).
_apply_worker_in_memory(request, provider)
- await _emit(request, SecretConfigured(key="brain.sub_jarvis.provider", action="set"))
+ await _emit(request, SecretConfigured(key="brain.worker.provider", action="set"))
return {
"ok": True,
@@ -1741,9 +1741,9 @@ async def jarvis_agent_model(body: SubagentModelBody, request: Request) -> dict[
persisted = False
if body.persist:
try:
- from jarvis.core.config_writer import set_sub_jarvis_model
+ from jarvis.core.config_writer import set_worker_model
- set_sub_jarvis_model(model)
+ set_worker_model(model)
persisted = True
except FileNotFoundError as exc:
raise HTTPException(status_code=500, detail=str(exc)) from exc
@@ -1756,7 +1756,7 @@ async def jarvis_agent_model(body: SubagentModelBody, request: Request) -> dict[
# choice immediately (workers resolve their chain per spawn from config).
_apply_worker_model_in_memory(request, model)
- await _emit(request, SecretConfigured(key="brain.sub_jarvis.model", action="set"))
+ await _emit(request, SecretConfigured(key="brain.worker.model", action="set"))
return {
"ok": True,
diff --git a/jarvis/ui/web/server.py b/jarvis/ui/web/server.py
index 28864be806..2c6281f3c2 100644
--- a/jarvis/ui/web/server.py
+++ b/jarvis/ui/web/server.py
@@ -268,7 +268,6 @@ class WebServer:
from .wiki_routes import router as wiki_router
from .wiki_ws import router as wiki_ws_router
from .workflows_routes import router as workflows_router
- from .workspace_routes import router as workspace_router
# Conductor ist ein externes Package im selben Monorepo. Import
# defensiv — wer das Repo ohne conductor checkt aus, kriegt sonst
# hier einen ImportError beim Server-Boot.
@@ -322,7 +321,6 @@ class WebServer:
# Contacts section — user-curated address book (pure file store, no Brain dep).
app.include_router(contacts_router)
app.include_router(workflows_router)
- app.include_router(workspace_router)
if conductor_router is not None:
app.include_router(conductor_router)
app.include_router(preview_router)
@@ -761,7 +759,7 @@ class WebServer:
"""
import shutil
- oc_cfg = cfg.harness.openclaw
+ oc_cfg = cfg.harness.jarvis_agent
router_primary = (cfg.brain.primary or "").lower()
try:
@@ -775,7 +773,7 @@ class WebServer:
to_worker_slug = None # type: ignore[assignment]
canonical_worker_provider = None # type: ignore[assignment]
- # The HEAVY-TASK subagent runs on ``[brain.sub_jarvis].provider`` —
+ # The HEAVY-TASK subagent runs on ``[brain.worker].provider`` —
# NOT on ``brain.primary`` (that is only the lightweight router
# brain). Mark the brain that ACTUALLY executes heavy tasks as
# active; fall back to the router brain only when no subagent
@@ -783,7 +781,7 @@ class WebServer:
# Mirrors jarvis/missions/init.py::_worker_factory so the displayed
# brain never drifts from the worker that runs. (Bug 2026-05-28:
# the UI showed Gemini active while heavy work ran on Claude.)
- sub_cfg = getattr(cfg.brain, "sub_jarvis", None)
+ sub_cfg = getattr(cfg.brain, "worker", None)
sub_raw = (
getattr(sub_cfg, "provider", None) if sub_cfg is not None else None
)
@@ -1956,12 +1954,14 @@ class WebServer:
data_dir.mkdir(parents=True, exist_ok=True)
db_path = data_dir / "missions.db"
- # Isolation-Root: <repo_parent>/sub-agents-outputs/. Repo-Root ist 4 Ebenen
- # ueber jarvis/ui/web/server.py: server.py -> web -> ui -> jarvis -> repo.
+ # Isolation-Root: <repo_parent>/jarvis-agent-outputs/ (preferred; falls back
+ # to <repo_parent>/sub-agents-outputs/ if only the old dir exists — see
+ # resolve_outputs_root). Repo-Root ist 4 Ebenen over jarvis/ui/web/server.py:
+ # server.py -> web -> ui -> jarvis -> repo.
repo_root = WEB_DIR.parent.parent.parent
# Test/benchmark isolation seam: an explicit JARVIS_ISOLATION_ROOT
# redirects the mission worktree container (and, with it, the startup
- # cleanup sweep) away from the SHARED production sub-agents-outputs/.
+ # cleanup sweep) away from the SHARED production outputs dir.
# Unset in production → unchanged behavior. Critical because
# ``startup_sweep`` is filesystem-driven (removes any entry older than
# cleanup_days by mtime, not DB-gated): without this seam an isolated
@@ -1971,7 +1971,8 @@ class WebServer:
if _iso_override:
isolation_root = Path(_iso_override)
else:
- isolation_root = repo_root.parent / "sub-agents-outputs"
+ from jarvis.missions.isolation.worktree import resolve_outputs_root
+ isolation_root = resolve_outputs_root(repo_root)
# Fail-closed primary-instance gate: POSITIVE proof is required.
# Only the launcher process, after confirming it holds the