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-07 19:36)
Ruben Lütkef72c225190f8
diff --git a/jarvis/ui/web/frontend/src/components/wiki/ObsidianSetupDialog.test.tsx b/jarvis/ui/web/frontend/src/components/wiki/ObsidianSetupDialog.test.tsxindex 00ea4595a9..0c54bcc8d5 100644--- a/jarvis/ui/web/frontend/src/components/wiki/ObsidianSetupDialog.test.tsx+++ b/jarvis/ui/web/frontend/src/components/wiki/ObsidianSetupDialog.test.tsx@@ -63,6 +63,32 @@ const STATUS_OK: ObsidianStatus = {recommended_action: "ok",};+const VAULTS = [+ { path: "C:/Users/Administrator/Notes", name: "Notes" },+ { path: "C:/Users/Administrator/Work", name: "Work" },+];++/**+ * Fetch stub that branches by URL: the vault-choice picker's ``GET+ * .../vaults`` and the register flow's ``POST .../register`` need+ * different bodies within the same test.+ */+function makeVaultAwareFetch(+ vaults: typeof VAULTS,+ registerBody: unknown,+): typeof fetch {+ return vi.fn(async (input: RequestInfo | URL) => {+ const href = typeof input === "string" ? input : input.toString();+ if (href.includes("/obsidian/vaults")) {+ return jsonResponse({ ok: true, config_exists: true, vaults });+ }+ if (href.includes("/obsidian/register")) {+ return jsonResponse(registerBody);+ }+ return jsonResponse({}, 404);+ }) as unknown as typeof fetch;+}+describe("ObsidianSetupDialog", () => {it("renders step 1 active when installed=false", () => {render(@@ -290,4 +316,149 @@ describe("ObsidianSetupDialog", () => {const marker3 = screen.getByTestId("obsidian-setup-step-marker-3");expect(marker3.getAttribute("data-state")).toBe("active");});++ describe("vault choice (spec A6)", () => {+ it("renders both vault-choice options, 'existing' enabled once the vault list loads", async () => {+ const fetchImpl = makeVaultAwareFetch(VAULTS, {+ status: "added",+ active_vault_root: "C:/Users/Administrator/wiki/obsidian-vault",+ restart_required: false,+ });+ render(+ <ObsidianSetupDialog+ open+ onClose={() => {}}+ initialStatus={STATUS_NOT_REGISTERED}+ fetchImpl={fetchImpl}+ />,+ );+ // "Separate" is the default and starts selected.+ const separate = screen.getByTestId("obsidian-setup-mode-separate");+ expect(separate.getAttribute("aria-checked")).toBe("true");++ // "Existing" starts disabled (no vault list yet) and enables once the+ // fetch resolves.+ await waitFor(() => {+ expect(+ screen.getByTestId("obsidian-setup-mode-existing").hasAttribute("disabled"),+ ).toBe(false);+ });+ expect(+ screen.getByTestId("obsidian-setup-mode-existing").getAttribute("aria-checked"),+ ).toBe("false");+ });++ it("choosing 'existing' + a vault registers with mode=existing and shows the target path", async () => {+ const fetchImpl = makeVaultAwareFetch(VAULTS, {+ status: "added",+ active_vault_root: "C:/Users/Administrator/Work/Jarvis",+ restart_required: true,+ });+ render(+ <ObsidianSetupDialog+ open+ onClose={() => {}}+ initialStatus={STATUS_NOT_REGISTERED}+ fetchImpl={fetchImpl}+ />,+ );+ await waitFor(() => {+ expect(+ screen.getByTestId("obsidian-setup-mode-existing").hasAttribute("disabled"),+ ).toBe(false);+ });+ fireEvent.click(screen.getByTestId("obsidian-setup-mode-existing"));++ const select = screen.getByTestId(+ "obsidian-setup-vault-select",+ ) as HTMLSelectElement;+ fireEvent.change(select, { target: { value: VAULTS[1].path } });++ fireEvent.click(screen.getByTestId("obsidian-setup-register"));++ await waitFor(() => {+ expect(fetchImpl).toHaveBeenCalledWith(+ "/api/setup/obsidian/register",+ expect.objectContaining({+ method: "POST",+ body: JSON.stringify({+ mode: "existing",+ existing_vault_path: VAULTS[1].path,+ }),+ }),+ );+ });++ await waitFor(() => {+ expect(screen.getByTestId("obsidian-setup-step-3")).toBeDefined();+ });+ const target = screen.getByTestId("obsidian-setup-active-vault-root");+ expect(target.textContent).toContain("C:/Users/Administrator/Work/Jarvis");+ expect(screen.getByTestId("obsidian-setup-restart-hint")).toBeDefined();+ });++ it("clicking 'Restart now' POSTs to the shared restart-app endpoint", async () => {+ const fetchImpl = makeVaultAwareFetch(VAULTS, {+ status: "added",+ active_vault_root: "C:/Users/Administrator/Notes/Jarvis",+ restart_required: true,+ });+ render(+ <ObsidianSetupDialog+ open+ onClose={() => {}}+ initialStatus={STATUS_NOT_REGISTERED}+ fetchImpl={fetchImpl}+ />,+ );+ await waitFor(() => {+ expect(+ screen.getByTestId("obsidian-setup-mode-existing").hasAttribute("disabled"),+ ).toBe(false);+ });+ fireEvent.click(screen.getByTestId("obsidian-setup-mode-existing"));+ fireEvent.click(screen.getByTestId("obsidian-setup-register"));++ const restartButton = await screen.findByTestId("obsidian-setup-restart-now");+ fireEvent.click(restartButton);++ await waitFor(() => {+ expect(fetchImpl).toHaveBeenCalledWith(+ "/api/settings/restart-app",+ expect.objectContaining({ method: "POST" }),+ );+ });+ });++ it("choosing 'existing' with an unknown path shows an inline error and stays on step 2", async () => {+ const fetchImpl = makeVaultAwareFetch(VAULTS, {+ status: "config_missing",+ error: "existing vault path not found",+ active_vault_root: "C:/Users/Administrator/wiki/obsidian-vault",+ restart_required: false,+ });+ render(+ <ObsidianSetupDialog+ open+ onClose={() => {}}+ initialStatus={STATUS_NOT_REGISTERED}+ fetchImpl={fetchImpl}+ />,+ );+ await waitFor(() => {+ expect(+ screen.getByTestId("obsidian-setup-mode-existing").hasAttribute("disabled"),+ ).toBe(false);+ });+ fireEvent.click(screen.getByTestId("obsidian-setup-mode-existing"));+ fireEvent.click(screen.getByTestId("obsidian-setup-register"));++ await waitFor(() => {+ expect(+ screen.getByTestId("obsidian-setup-register-error").textContent,+ ).toContain("existing vault path not found");+ });+ expect(screen.getByTestId("obsidian-setup-step-2")).toBeDefined();+ });+ });});diff --git a/jarvis/ui/web/frontend/src/components/wiki/ObsidianSetupDialog.tsx b/jarvis/ui/web/frontend/src/components/wiki/ObsidianSetupDialog.tsxindex f320af567e..6326dadf28 100644--- a/jarvis/ui/web/frontend/src/components/wiki/ObsidianSetupDialog.tsx+++ b/jarvis/ui/web/frontend/src/components/wiki/ObsidianSetupDialog.tsx@@ -7,7 +7,16 @@** 1. Install Obsidian (skipped when ``installed=true``).* 2. Register the Jarvis vault via ``POST /api/setup/obsidian/register``.- * 3. Live-test the ``obsidian://open?vault=…`` URL scheme.+ * Offers a vault-choice pick first (spec A6): "create a separate+ * Jarvis vault" (default) or "use my existing vault", the latter fed+ * by ``GET /api/setup/obsidian/vaults`` and enabled only once that+ * list is non-empty.+ * 3. Live-test the ``obsidian://open?vault=…`` URL scheme. Also shows the+ * ``active_vault_root`` returned by step 2 and, when the backend+ * reports ``restart_required`` (always true for the "existing" vault+ * choice — the running wiki index still targets the old vault root+ * until relaunch), a one-click restart wired to the same+ * ``POST /api/settings/restart-app`` relauncher the Settings panel uses.** The component never talks to the global event store and never wires* itself into the chat/voice path. It is a self-contained dialog whose@@ -548,15 +557,86 @@ export function ObsidianSetupDialog({</code>{" "}{t("obsidian_setup_dialog.connect_body_3")}</p>- <p- className="rounded-md border border-border bg-background/40 px-3 py-2 text-xs text-muted-foreground"- data-testid="obsidian-setup-vault-path"++ <div+ role="radiogroup"+ aria-label={t("obsidian_setup_dialog.vault_choice_heading")}+ className="space-y-2"+ data-testid="obsidian-setup-vault-choice">- <span className="block text-[10px] uppercase tracking-wide text-muted-foreground/70">- {t("obsidian_setup_dialog.vault_path_label")}- </span>- <span className="font-mono text-foreground">{vaultPath}</span>- </p>+ <button+ type="button"+ role="radio"+ aria-checked={registerMode === "separate"}+ onClick={() => setRegisterMode("separate")}+ data-testid="obsidian-setup-mode-separate"+ className={cn(+ "w-full rounded-md border px-3 py-2 text-left transition-colors",+ registerMode === "separate"+ ? "border-primary bg-primary/5 ring-1 ring-primary/50"+ : "border-border bg-background/40 hover:border-primary/50",+ )}+ >+ <span className="block text-sm font-medium text-foreground">+ {t("obsidian_setup_dialog.mode_separate_label")}+ </span>+ <span className="block text-xs text-muted-foreground">+ {t("obsidian_setup_dialog.mode_separate_hint")}+ </span>+ </button>++ <button+ type="button"+ role="radio"+ aria-checked={registerMode === "existing"}+ disabled={vaults.length === 0}+ onClick={() => setRegisterMode("existing")}+ data-testid="obsidian-setup-mode-existing"+ className={cn(+ "w-full rounded-md border px-3 py-2 text-left transition-colors disabled:cursor-not-allowed disabled:opacity-60",+ registerMode === "existing"+ ? "border-primary bg-primary/5 ring-1 ring-primary/50"+ : "border-border bg-background/40 hover:border-primary/50",+ )}+ >+ <span className="block text-sm font-medium text-foreground">+ {t("obsidian_setup_dialog.mode_existing_label")}+ </span>+ <span className="block text-xs text-muted-foreground">+ {vaults.length === 0+ ? t("obsidian_setup_dialog.mode_existing_disabled_hint")+ : t("obsidian_setup_dialog.mode_existing_hint")}+ </span>+ </button>++ {registerMode === "existing" && vaults.length > 0 && (+ <select+ aria-label={t("obsidian_setup_dialog.vault_select_label")}+ value={selectedVaultPath ?? ""}+ onChange={(e) => setSelectedVaultPath(e.target.value)}+ data-testid="obsidian-setup-vault-select"+ className="w-full rounded-md border border-input bg-background px-3 py-2 text-sm"+ >+ {vaults.map((v) => (+ <option key={v.path} value={v.path} title={v.path}>+ {v.name}+ </option>+ ))}+ </select>+ )}+ </div>++ {registerMode === "separate" && (+ <p+ className="rounded-md border border-border bg-background/40 px-3 py-2 text-xs text-muted-foreground"+ data-testid="obsidian-setup-vault-path"+ >+ <span className="block text-[10px] uppercase tracking-wide text-muted-foreground/70">+ {t("obsidian_setup_dialog.vault_path_label")}+ </span>+ <span className="font-mono text-foreground">{vaultPath}</span>+ </p>+ )}{registerHint && (<pclassName="rounded-md border border-[#ffb84d]/40 bg-[#ffb84d]/10 px-3 py-2 text-xs text-[#ffb84d]"@@ -598,8 +678,11 @@ export function ObsidianSetupDialog({<Buttontype="button"size="sm"- onClick={() => void handleRegister()}- disabled={registering}+ onClick={handleConfirmRegister}+ disabled={+ registering ||+ (registerMode === "existing" && !selectedVaultPath)+ }data-testid="obsidian-setup-register">{registering ? (@@ -633,6 +716,37 @@ export function ObsidianSetupDialog({<p className="text-sm text-muted-foreground">{t("obsidian_setup_dialog.live_test_body")}</p>+ {activeVaultRoot && (+ <p+ className="rounded-md border border-border bg-background/40 px-3 py-2 text-xs text-muted-foreground"+ data-testid="obsidian-setup-active-vault-root"+ >+ {t("obsidian_setup_dialog.active_vault_label")}:{" "}+ <span className="font-mono text-foreground">{activeVaultRoot}</span>+ </p>+ )}+ {restartRequired && (+ <div+ className="space-y-2 rounded-md border border-primary/40 bg-primary/5 p-3"+ data-testid="obsidian-setup-restart-hint"+ >+ <p className="text-xs text-muted-foreground">+ {t("obsidian_setup_dialog.restart_required_hint")}+ </p>+ <Button+ type="button"+ variant="outline"+ size="sm"+ onClick={() => void handleRestartNow()}+ disabled={restarting}+ data-testid="obsidian-setup-restart-now"+ >+ {restarting+ ? t("obsidian_setup_dialog.restarting")+ : t("obsidian_setup_dialog.restart_now")}+ </Button>+ </div>+ )}<div className="flex items-center justify-start gap-2 pt-1"><Buttontype="button"diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.jsonindex ca372b39b2..6a99a17db5 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json@@ -1789,7 +1789,18 @@"live_test_body": "Klick den Knopf — dein Browser öffnet das Vault direkt in Obsidian.","open_in_obsidian": "In Obsidian öffnen","did_not_work": "Hat nicht geklappt",- "it_worked": "Hat geklappt — Fertig"+ "it_worked": "Hat geklappt — Fertig",+ "vault_choice_heading": "Wo soll {name} sein Wiki ablegen?",+ "mode_separate_label": "Ein eigenes Jarvis-Vault anlegen",+ "mode_separate_hint": "Der Standard — {name} führt ein eigenes Vault, getrennt von deinen anderen Notizen.",+ "mode_existing_label": "Mein vorhandenes Vault nutzen",+ "mode_existing_hint": "{name} schreibt in einen \"Jarvis\"-Unterordner innerhalb des gewählten Vaults.",+ "mode_existing_disabled_hint": "Keine vorhandenen Vaults gefunden — registriere zuerst eines in Obsidian.",+ "vault_select_label": "Vorhandenes Vault",+ "active_vault_label": "{name} schreibt nach",+ "restart_required_hint": "Starte {name} neu, damit der neue Speicherort verwendet wird.",+ "restart_now": "Jetzt neu starten",+ "restarting": "Starte neu…"},"docs_sidebar": {"title": "Dokumentation",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.jsonindex 2411589459..81ddaf1847 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json@@ -1790,7 +1790,18 @@"live_test_body": "Click the button — your browser opens the vault directly in Obsidian.","open_in_obsidian": "Open in Obsidian","did_not_work": "It didn't work",- "it_worked": "It worked — done"+ "it_worked": "It worked — done",+ "vault_choice_heading": "Where should Jarvis keep its wiki?",+ "mode_separate_label": "Create a separate Jarvis vault",+ "mode_separate_hint": "The default — Jarvis keeps its own vault, isolated from your other notes.",+ "mode_existing_label": "Use my existing vault",+ "mode_existing_hint": "Jarvis writes into a \"Jarvis\" subfolder inside the vault you pick.",+ "mode_existing_disabled_hint": "No existing vaults found — register one in Obsidian first.",+ "vault_select_label": "Existing vault",+ "active_vault_label": "Jarvis writes to",+ "restart_required_hint": "Restart Jarvis to start writing to the new location.",+ "restart_now": "Restart now",+ "restarting": "Restarting…"},"docs_sidebar": {"title": "Documentation",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.jsonindex cd23008d7c..366eae542c 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json@@ -1789,7 +1789,18 @@"live_test_body": "Haz clic en el botón — tu navegador abre el almacén directamente en Obsidian.","open_in_obsidian": "Abrir en Obsidian","did_not_work": "No funcionó",- "it_worked": "Funcionó — listo"+ "it_worked": "Funcionó — listo",+ "vault_choice_heading": "¿Dónde debería {name} guardar su wiki?",+ "mode_separate_label": "Crear un almacén independiente para {name}",+ "mode_separate_hint": "La opción predeterminada — {name} mantiene su propio almacén, separado de tus otras notas.",+ "mode_existing_label": "Usar mi almacén existente",+ "mode_existing_hint": "{name} escribe en una subcarpeta \"Jarvis\" dentro del almacén que elijas.",+ "mode_existing_disabled_hint": "No se encontraron almacenes existentes — registra uno en Obsidian primero.",+ "vault_select_label": "Almacén existente",+ "active_vault_label": "{name} escribe en",+ "restart_required_hint": "Reinicia {name} para empezar a escribir en la nueva ubicación.",+ "restart_now": "Reiniciar ahora",+ "restarting": "Reiniciando…"},"docs_sidebar": {"title": "Documentación",