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.

chore: auto-save WIP via Claude stop-hook safety net (2026-07-01 20:04)

Ruben Lütke2431818b2d59
diff --git a/jarvis/ui/desktop_app.py b/jarvis/ui/desktop_app.py
index aded28e175..593c8d5a57 100644
--- a/jarvis/ui/desktop_app.py
+++ b/jarvis/ui/desktop_app.py
@@ -2703,6 +2703,20 @@ class DesktopApp:
gui = "edgechromium" if sys.platform == "win32" else None
debug = os.environ.get("JARVIS_WEBVIEW_DEBUG") == "1"
+ # Native file drag-out: dragging a saved-download toast drops the REAL
+ # file into any app (Explorer, a browser upload zone, a chat). Must be
+ # installed BEFORE webview.start() — it patches the WebView2 UI-thread
+ # message handler so DoDragDrop runs where the mouse press lives. Windows
+ # only for now; a logged no-op elsewhere. Never blocks the window.
+ try:
+ from pathlib import Path as _Path
+
+ from jarvis.ui.native_drag import install_native_drag
+
+ install_native_drag(allowed_base_dirs=[_Path.home() / "Downloads"])
+ except Exception: # noqa: BLE001 — the drag bridge is never load-bearing
+ pass
+
# webview.start blocks the main thread. func/args gets called after
# the first load (pywebview-internal), so evaluate_js hits a
# DOM-ready context.
diff --git a/jarvis/ui/web/frontend/src/components/ToastLayer.tsx b/jarvis/ui/web/frontend/src/components/ToastLayer.tsx
index 8ef77c65a1..56f93392b5 100644
--- a/jarvis/ui/web/frontend/src/components/ToastLayer.tsx
+++ b/jarvis/ui/web/frontend/src/components/ToastLayer.tsx
@@ -6,10 +6,12 @@ import {
XCircle,
FolderOpen,
ExternalLink,
+ GripVertical,
} from "lucide-react";
import { useEventStore, type Toast } from "@/store/events";
import { cn } from "@/lib/utils";
import { openDownloadedFile, revealInFolder } from "@/lib/fileActions";
+import { canNativeDrag, startNativeFileDrag } from "@/lib/nativeDrag";
import { useT } from "@/i18n";
const ICON_FOR_KIND = {
@@ -34,31 +36,62 @@ const ACCENT_FOR_KIND: Record<Toast["kind"], string> = {
};
export function ToastLayer() {
+ const t = useT();
const toasts = useEventStore((s) => s.toasts);
const dismiss = useEventStore((s) => s.dismissToast);
return (
<div className="pointer-events-none fixed right-4 top-4 z-50 flex w-[320px] flex-col gap-2">
- {toasts.map((t) => {
- const Icon = ICON_FOR_KIND[t.kind];
+ {toasts.map((toast) => {
+ const Icon = ICON_FOR_KIND[toast.kind];
+ // A saved-file toast in the desktop shell is a native drag handle: press
+ // and drag it to drop the real file into any app. The buttons stay as a
+ // fallback (and are the only path in a plain browser / on the VPS).
+ const draggable = Boolean(toast.filePath) && canNativeDrag();
return (
<div
- key={t.id}
+ key={toast.id}
role="status"
+ draggable={false}
+ onDragStart={draggable ? (e) => e.preventDefault() : undefined}
+ onMouseDown={
+ draggable
+ ? (e) => {
+ if (e.button === 0 && toast.filePath) {
+ startNativeFileDrag(toast.filePath);
+ }
+ }
+ : undefined
+ }
+ title={draggable ? t("file_toast.drag_hint") : undefined}
className={cn(
"pointer-events-auto flex items-start gap-3 rounded-lg border px-3 py-2.5 text-sm backdrop-blur",
"animate-in slide-in-from-right-4 fade-in duration-200",
- STYLE_FOR_KIND[t.kind],
+ STYLE_FOR_KIND[toast.kind],
+ draggable && "cursor-grab active:cursor-grabbing select-none",
)}
>
- <Icon className={cn("mt-0.5 h-4 w-4 shrink-0", ACCENT_FOR_KIND[t.kind])} />
+ {draggable ? (
+ <GripVertical className="mt-0.5 h-4 w-4 shrink-0 text-primary" />
+ ) : (
+ <Icon className={cn("mt-0.5 h-4 w-4 shrink-0", ACCENT_FOR_KIND[toast.kind])} />
+ )}
<div className="min-w-0 flex-1 text-xs leading-relaxed">
- <div className="break-words">{t.message}</div>
- {t.filePath && <FileToastActions path={t.filePath} />}
+ <div className="break-words">{toast.message}</div>
+ {draggable && (
+ <div className="mt-1 text-[11px] font-medium text-primary/80">
+ {t("file_toast.drag_hint")}
+ </div>
+ )}
+ {toast.filePath && (
+ <FileToastActions path={toast.filePath} />
+ )}
</div>
<button
type="button"
- onClick={() => dismiss(t.id)}
+ // Don't let a click on the X start a drag.
+ onMouseDown={(e) => e.stopPropagation()}
+ onClick={() => dismiss(toast.id)}
className="shrink-0 text-muted-foreground transition-colors hover:text-foreground"
aria-label="Dismiss"
>
@@ -73,10 +106,8 @@ export function ToastLayer() {
/**
* "Show in folder" / "Open" actions for a toast that carries a saved file path.
- *
- * Dragging a file straight out of the embedded WebView is not reliably possible
- * on any OS, so we bring the user to the real file in their file manager (from
- * which a native drag to anywhere works) — or open it directly.
+ * These are the reliable fallback everywhere (and the only path in a plain
+ * browser / on the VPS, where the native drag handle is unavailable).
*/
function FileToastActions({ path }: { path: string }) {
const t = useT();
@@ -91,8 +122,9 @@ function FileToastActions({ path }: { path: string }) {
if (!ok) pushToast("error", t("file_toast.open_failed"));
};
+ // stopPropagation on mousedown so clicking a button never starts a file drag.
return (
- <div className="mt-2 flex flex-wrap gap-1.5">
+ <div className="mt-2 flex flex-wrap gap-1.5" onMouseDown={(e) => e.stopPropagation()}>
<button
type="button"
onClick={onReveal}
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.json
index 779cef9e73..4b4272cb2b 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json
@@ -3,7 +3,8 @@
"show_in_folder": "Im Ordner zeigen",
"open": "Öffnen",
"reveal_failed": "Ordner konnte nicht geöffnet werden",
- "open_failed": "Datei konnte nicht geöffnet werden"
+ "open_failed": "Datei konnte nicht geöffnet werden",
+ "drag_hint": "Zieh mich überallhin — in einen Ordner, auf eine Website, in einen Chat"
},
"jarvis_dock": {
"aria": "{name} — zieh eine Mission hierher, um darüber zu sprechen",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.json
index 7f396d5394..7aa7f771bd 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json
@@ -3,7 +3,8 @@
"show_in_folder": "Show in folder",
"open": "Open",
"reveal_failed": "Could not open the folder",
- "open_failed": "Could not open the file"
+ "open_failed": "Could not open the file",
+ "drag_hint": "Drag me anywhere — to a folder, a website, a chat"
},
"jarvis_dock": {
"aria": "{name} — drop a mission here to talk about it",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.json
index 1cd30b6bbf..c2c838bde7 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json
@@ -3,7 +3,8 @@
"show_in_folder": "Mostrar en la carpeta",
"open": "Abrir",
"reveal_failed": "No se pudo abrir la carpeta",
- "open_failed": "No se pudo abrir el archivo"
+ "open_failed": "No se pudo abrir el archivo",
+ "drag_hint": "Arrástrame a cualquier sitio: a una carpeta, una web, un chat"
},
"jarvis_dock": {
"aria": "{name} — suelta una misión aquí para hablar de ella",