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 19:13)

Ruben Lütkea53ce9dc0f02
diff --git a/.githooks/pre-commit b/.githooks/pre-commit
index 74f2ea7aa1..6cd8983755 100755
--- a/.githooks/pre-commit
+++ b/.githooks/pre-commit
@@ -46,4 +46,23 @@ if [ "$rc" -eq 2 ]; then
exit 1
fi
+# --- LANGUAGE gate (FAIL-CLOSED on confirmed German) --------------------------
+# English-only artifacts (CLAUDE.md rule 1). Checks the STAGED changes so new
+# German is caught at COMMIT time — the real write path (incl. the auto-save
+# stop-hook), which never pushes and so never reached the pre-push language gate.
+# rc == 1 means a CONFIRMED newly-added German line; any other rc fails OPEN
+# (never wedge a commit on tooling noise — pre-push + CI are the backstops).
+lang="scripts/ci/check_no_new_german.py"
+if [ -f "$lang" ]; then
+ "$PY" "$lang" --staged </dev/null
+ if [ "$?" -eq 1 ]; then
+ echo ""
+ echo "pre-commit BLOCKED: LANGUAGE gate — newly added German in staged changes."
+ echo " Artifacts must be English (CLAUDE.md rule 1). Translate the lines above,"
+ echo " or mark an intentionally-German product-surface line with 'i18n-allow'."
+ echo " Bypass once with: git commit --no-verify"
+ exit 1
+ fi
+fi
+
exit 0
diff --git a/jarvis/ui/web/frontend/src/components/ToastLayer.tsx b/jarvis/ui/web/frontend/src/components/ToastLayer.tsx
index 6dfb7a8d72..8ef77c65a1 100644
--- a/jarvis/ui/web/frontend/src/components/ToastLayer.tsx
+++ b/jarvis/ui/web/frontend/src/components/ToastLayer.tsx
@@ -1,6 +1,16 @@
-import { X, Info, CheckCircle2, AlertTriangle, XCircle } from "lucide-react";
+import {
+ X,
+ Info,
+ CheckCircle2,
+ AlertTriangle,
+ XCircle,
+ FolderOpen,
+ ExternalLink,
+} from "lucide-react";
import { useEventStore, type Toast } from "@/store/events";
import { cn } from "@/lib/utils";
+import { openDownloadedFile, revealInFolder } from "@/lib/fileActions";
+import { useT } from "@/i18n";
const ICON_FOR_KIND = {
info: Info,
@@ -42,7 +52,10 @@ export function ToastLayer() {
)}
>
<Icon className={cn("mt-0.5 h-4 w-4 shrink-0", ACCENT_FOR_KIND[t.kind])} />
- <div className="min-w-0 flex-1 text-xs leading-relaxed">{t.message}</div>
+ <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>
<button
type="button"
onClick={() => dismiss(t.id)}
@@ -57,3 +70,45 @@ export function ToastLayer() {
</div>
);
}
+
+/**
+ * "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.
+ */
+function FileToastActions({ path }: { path: string }) {
+ const t = useT();
+ const pushToast = useEventStore((s) => s.pushToast);
+
+ const onReveal = async () => {
+ const ok = await revealInFolder(path);
+ if (!ok) pushToast("error", t("file_toast.reveal_failed"));
+ };
+ const onOpen = async () => {
+ const ok = await openDownloadedFile(path);
+ if (!ok) pushToast("error", t("file_toast.open_failed"));
+ };
+
+ return (
+ <div className="mt-2 flex flex-wrap gap-1.5">
+ <button
+ type="button"
+ onClick={onReveal}
+ className="inline-flex items-center gap-1 rounded-md border border-primary/40 bg-primary/10 px-2 py-1 text-[11px] font-medium text-primary transition-colors hover:bg-primary/20"
+ >
+ <FolderOpen className="h-3 w-3" />
+ {t("file_toast.show_in_folder")}
+ </button>
+ <button
+ type="button"
+ onClick={onOpen}
+ className="inline-flex items-center gap-1 rounded-md border border-border bg-background/40 px-2 py-1 text-[11px] font-medium text-foreground/90 transition-colors hover:bg-background/70"
+ >
+ <ExternalLink className="h-3 w-3" />
+ {t("file_toast.open")}
+ </button>
+ </div>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.json
index fe2c18d66f..779cef9e73 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json
@@ -1,4 +1,10 @@
{
+ "file_toast": {
+ "show_in_folder": "Im Ordner zeigen",
+ "open": "Öffnen",
+ "reveal_failed": "Ordner konnte nicht geöffnet werden",
+ "open_failed": "Datei konnte nicht geöffnet werden"
+ },
"jarvis_dock": {
"aria": "{name} — zieh eine Mission hierher, um darüber zu sprechen",
"hint": "Zieh ein Jarvis-Agent-Ergebnis hierher, um es ins Gespräch zu holen",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.json
index 8695e29cb0..7f396d5394 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json
@@ -1,4 +1,10 @@
{
+ "file_toast": {
+ "show_in_folder": "Show in folder",
+ "open": "Open",
+ "reveal_failed": "Could not open the folder",
+ "open_failed": "Could not open the file"
+ },
"jarvis_dock": {
"aria": "{name} — drop a mission here to talk about it",
"hint": "Drag a Jarvis-Agent output here to pull it into the conversation",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.json
index 6b706cb89b..1cd30b6bbf 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json
@@ -1,4 +1,10 @@
{
+ "file_toast": {
+ "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"
+ },
"jarvis_dock": {
"aria": "{name} — suelta una misión aquí para hablar de ella",
"hint": "Arrastra un resultado de Jarvis-Agent aquí para llevarlo a la conversación",
diff --git a/jarvis/ui/web/frontend/src/lib/fileActions.ts b/jarvis/ui/web/frontend/src/lib/fileActions.ts
new file mode 100644
index 0000000000..844ff640fc
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/lib/fileActions.ts
@@ -0,0 +1,43 @@
+/**
+ * Native file actions for a file already saved to the user's Downloads folder.
+ *
+ * Why this exists: dragging a file OUT of the embedded desktop WebView is not
+ * reliably possible on any OS (WebView2's HTML5 drag-and-drop is broken;
+ * WKWebView/WebKitGTK don't support the Chromium `DownloadURL` drag format). So
+ * instead of a broken drag, the UI lets the user reveal the real file in the OS
+ * file manager (and drag it natively from there) or open it directly. Both are
+ * desktop-only backend calls; on a headless VPS the routes 404 and these return
+ * false.
+ */
+
+/** Open the OS file manager with `path` selected. Returns true on success. */
+export async function revealInFolder(path: string): Promise<boolean> {
+ return postFileAction("/api/downloads/reveal", path, "revealed");
+}
+
+/** Open `path` with its default application. Returns true on success. */
+export async function openDownloadedFile(path: string): Promise<boolean> {
+ return postFileAction("/api/downloads/open", path, "opened");
+}
+
+async function postFileAction(
+ url: string,
+ path: string,
+ okKey: "revealed" | "opened",
+): Promise<boolean> {
+ try {
+ const res = await fetch(url, {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({ path }),
+ });
+ if (!res.ok) return false;
+ const data = (await res.json().catch(() => null)) as Record<
+ string,
+ unknown
+ > | null;
+ return Boolean(data?.[okKey]);
+ } catch {
+ return false;
+ }
+}
diff --git a/jarvis/ui/web/frontend/src/store/events.ts b/jarvis/ui/web/frontend/src/store/events.ts
index 0fd1adc9e4..600f2c46a8 100644
--- a/jarvis/ui/web/frontend/src/store/events.ts
+++ b/jarvis/ui/web/frontend/src/store/events.ts
@@ -242,7 +242,11 @@ interface EventStore {
clearEvents: () => void;
setActiveSection: (s: SectionId) => void;
setTranscription: (text: string, isFinal: boolean) => void;
- pushToast: (kind: Toast["kind"], message: string) => void;
+ pushToast: (
+ kind: Toast["kind"],
+ message: string,
+ opts?: { filePath?: string; filename?: string },
+ ) => void;
dismissToast: (id: string) => void;
pushMessage: (m: ChatMessage) => void;
setMessages: (m: ChatMessage[]) => void;
@@ -270,6 +274,9 @@ interface EventStore {
const MAX_EVENTS = 500;
const MAX_MESSAGES = 200;
const TOAST_TTL_MS = 3500;
+// A file toast carries "Show in folder" / "Open" actions the user must have time
+// to aim at and click — keep it up noticeably longer than a plain notification.
+const TOAST_FILE_TTL_MS = 12000;
// Finished reasoning traces are per-message UI sugar, not history — cap the
// map so a long session cannot grow it unbounded (insertion order = age).
const MAX_TRACES = 24;
@@ -320,12 +327,19 @@ export const useEventStore = create<EventStore>((set, get) => ({
setTranscription: (text, isFinal) =>
set({ transcription: text, transcriptionFinal: isFinal }),
- pushToast: (kind, message) => {
+ pushToast: (kind, message, opts) => {
const id = `toast-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`;
+ const filePath = opts?.filePath;
set((state) => ({
- toasts: [...state.toasts, { id, kind, message, ts: Date.now() }],
+ toasts: [
+ ...state.toasts,
+ { id, kind, message, ts: Date.now(), filePath, filename: opts?.filename },
+ ],
}));
- setTimeout(() => get().dismissToast(id), TOAST_TTL_MS);
+ setTimeout(
+ () => get().dismissToast(id),
+ filePath ? TOAST_FILE_TTL_MS : TOAST_TTL_MS,
+ );
},
dismissToast: (id) =>