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
chore: auto-save WIP via Claude stop-hook safety net (2026-07-01 19:11)
Ruben Lütke823d42652dce
diff --git a/jarvis/ui/web/downloads_routes.py b/jarvis/ui/web/downloads_routes.pyindex 2438aee007..2670d443c4 100644--- a/jarvis/ui/web/downloads_routes.py+++ b/jarvis/ui/web/downloads_routes.py@@ -16,12 +16,21 @@ download.Endpoints:GET /api/downloads/capabilities {native_file_actions, platform}POST /api/downloads/save Write base64 bytes to ~/Downloads+ POST /api/downloads/reveal Open the OS file manager with a saved file selected+ POST /api/downloads/open Open a saved file with its default app-``POST /save`` is **desktop-only**: it is gated on+``POST /save``, ``/reveal`` and ``/open`` are **desktop-only**: they are gated on``app.state.native_file_actions`` (True on a local desktop run, False on a-headless VPS) and 404s when False — on a server the file would land on the-*server's* disk, not the user's machine, so the frontend keeps the browser+headless VPS) and 404 when False — on a server the file would land on / open on+the *server's* disk, not the user's machine, so the frontend keeps the browserdownload there. Loopback-only (server binds 127.0.0.1) — no auth token needed.++Why ``/reveal`` + ``/open`` exist: dragging a file OUT of the embedded WebView is+not reliably possible on ANY OS (WebView2's HTML5 drag-and-drop is broken;+WKWebView/WebKitGTK lack the Chromium ``DownloadURL`` drag format). So instead of+a broken drag, the UI offers a one-click "reveal in the file manager" — from+which the user drags the REAL file natively, anywhere, on every OS — plus a+plain "open"."""from __future__ import annotations@@ -135,3 +144,75 @@ async def save_to_downloads(filename=target.name,bytes_written=len(data),)+++class PathRequest(BaseModel):+ """A single absolute path to a previously-saved download."""++ path: str = Field(min_length=1, max_length=4096)+++def _require_native(request: Request) -> None:+ """404 unless this is a local desktop run (native file actions enabled).++ On a headless VPS the file lives on the server's disk, so revealing/opening+ it would act on the server, not the user's machine — the frontend must not+ reach these routes there.+ """+ if not bool(getattr(request.app.state, "native_file_actions", False)):+ raise HTTPException(status_code=404, detail="native-file-actions-disabled")+++def _resolve_saved_file(path_str: str) -> Path:+ """Resolve *path_str* to an existing file inside the user's ~/Downloads.++ Fail-closed path safety: the path is fully resolved (so ``..`` traversal and+ symlinks cannot escape) and must sit inside ``~/Downloads`` — the only place+ ``/save`` ever writes. This keeps a compromised/renderer-supplied path from+ revealing or opening arbitrary files on disk. Raises an HTTPException on any+ miss; never returns an out-of-tree or missing path.+ """+ try:+ p = Path(path_str).resolve()+ except OSError as exc:+ raise HTTPException(status_code=400, detail="invalid-path") from exc+ downloads = (Path.home() / "Downloads").resolve()+ if p != downloads and downloads not in p.parents:+ raise HTTPException(status_code=403, detail="path-outside-downloads")+ if not p.is_file():+ raise HTTPException(status_code=404, detail="file-not-found")+ return p++[email protected]("/reveal")+def reveal_download(request: Request, body: PathRequest) -> dict[str, Any]:+ """Open the OS file manager with the saved file selected/highlighted.++ Desktop-only. The user then drags the REAL file from the file manager to any+ target (folder, browser upload zone, chat) — a native OS drag the embedded+ WebView cannot do itself. Cross-platform via ``open_path.reveal_in_folder``+ (Explorer ``/select`` on Windows, ``open -R`` on macOS, folder on Linux).+ """+ _require_native(request)+ target = _resolve_saved_file(body.path)+ from jarvis.platform.open_path import reveal_in_folder++ revealed = reveal_in_folder(target)+ log.info("DownloadReveal: %s (revealed=%s)", target, revealed)+ return {"revealed": revealed}++[email protected]("/open")+def open_download(request: Request, body: PathRequest) -> dict[str, Any]:+ """Open the saved file with the OS default application. Desktop-only.++ Cross-platform via ``open_path.open_file`` (``os.startfile`` / ``open`` /+ ``xdg-open``). Returns ``{opened: false}`` if no launcher could be invoked.+ """+ _require_native(request)+ target = _resolve_saved_file(body.path)+ from jarvis.platform.open_path import open_file++ opened = open_file(target)+ log.info("DownloadOpen: %s (opened=%s)", target, opened)+ return {"opened": opened}diff --git a/jarvis/ui/web/frontend/src/store/events.ts b/jarvis/ui/web/frontend/src/store/events.tsindex 9c3b127896..0fd1adc9e4 100644--- a/jarvis/ui/web/frontend/src/store/events.ts+++ b/jarvis/ui/web/frontend/src/store/events.ts@@ -110,6 +110,14 @@ export interface Toast {kind: "info" | "success" | "warning" | "error";message: string;ts: number;+ /**+ * Absolute path of a file that was just saved to the user's Downloads. When+ * set (desktop only), the toast renders "Show in folder" / "Open" actions and+ * stays up longer so the user has time to click them. Empty in the browser/VPS.+ */+ filePath?: string;+ /** Display name of the saved file (shown next to the actions). */+ filename?: string;}export interface ChatMessage {diff --git a/scripts/ci/check_no_new_german.py b/scripts/ci/check_no_new_german.pyindex 4470e9e094..a1cc205e63 100644--- a/scripts/ci/check_no_new_german.py+++ b/scripts/ci/check_no_new_german.py@@ -178,6 +178,39 @@ def get_diff(base: str) -> str:return result.stdout+def get_staged_diff() -> str:+ """Unified diff of the STAGED index vs HEAD (additions only) — for pre-commit.++ Lets the gate run at COMMIT time (the real write path, incl. the auto-save+ stop-hook), not only on an explicit push/PR.+ """+ result = _git(["diff", "--cached", "--unified=0", "--no-color", "--diff-filter=AM"])+ return result.stdout+++def scan_all_tracked(patterns: list[str]) -> list[tuple[str, int, str]]:+ """Whole-tree scan of every git-tracked, scanned, non-allowlisted file.++ For the public-release gate: a depersonalized snapshot must be German-free in+ FULL, not just in a diff (the diff/PR gates are structurally blind to backlog).+ """+ out: list[tuple[str, int, str]] = []+ for path in _git(["ls-files"]).stdout.splitlines():+ path = path.strip()+ if not path or not is_scanned(path) or is_allowlisted(path, patterns):+ continue+ try:+ content = (Path.cwd() / path).read_text(encoding="utf-8", errors="replace")+ except OSError:+ continue+ for lineno, line in enumerate(content.splitlines(), start=1):+ if _INLINE_ESCAPE in line:+ continue+ if looks_german(line):+ out.append((path, lineno, line.strip()[:120]))+ return out++def main(argv: list[str] | None = None) -> int:argv = list(sys.argv[1:] if argv is None else argv)# Windows consoles default to cp1252; make the stream UTF-8 where@@ -187,17 +220,31 @@ def main(argv: list[str] | None = None) -> int:except (AttributeError, ValueError):pass- base = resolve_base(argv)- diff_text = get_diff(base)- added = parse_added_lines(diff_text)+ flags = {a for a in argv if a.startswith("--")}+ positional = [a for a in argv if not a.startswith("--")]patterns = load_allowlist()- violations = find_violations(added, patterns)++ if "--all" in flags:+ # Whole-tree scan (public-release snapshot gate).+ violations = scan_all_tracked(patterns)+ scope = "whole tree"+ elif "--staged" in flags:+ # Staged index vs HEAD (pre-commit).+ added = parse_added_lines(get_staged_diff())+ violations = find_violations(added, patterns)+ scope = "staged changes"+ else:+ # Default: added lines vs a diff base (pre-push / PR CI).+ base = resolve_base(positional)+ added = parse_added_lines(get_diff(base))+ violations = find_violations(added, patterns)+ scope = f"added lines (diff base: {base})"if violations:- print("OUTPUT-LANGUAGE GATE FAILED - newly added German text detected.\n")+ print("OUTPUT-LANGUAGE GATE FAILED - German text detected.\n")print("Every committed artifact must be English (CLAUDE.md, Output Language\n"- "Policy). The lines below were ADDED by this change and look German:\n"+ f"Policy). The lines below ({scope}) look German:\n")for path, lineno, text in violations:print(f" [x] {path}:{lineno}")@@ -210,10 +257,7 @@ def main(argv: list[str] | None = None) -> int:)return 1- print(- f"output-language gate OK - no new German in the added lines "- f"(diff base: {base})."- )+ print(f"output-language gate OK - no German ({scope}).")return 0