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(ui): add wiki health status strip

Ruben Lütkef38ef290f283
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.json
index 02f5e07071..768a33ec64 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json
@@ -2139,6 +2139,21 @@
"manual_b": "-Datei in",
"manual_c": "ablegen."
},
+ "wiki_health": {
+ "checking": "Wiki-Zustand wird geprüft…",
+ "unavailable": "Wiki-Zustandsprüfung nicht verfügbar",
+ "vault_prefix": "Vault: {0}",
+ "vault_unknown": "Vault-Pfad unbekannt",
+ "last_write_ok": "Letzter Schreibvorgang: {0} · ok",
+ "last_write_failed": "Letzter Schreibvorgang fehlgeschlagen: {0}",
+ "last_write_failed_unknown": "Letzter Schreibvorgang fehlgeschlagen",
+ "no_writes_yet": "Noch keine Schreibvorgänge erfasst",
+ "bootstrap_failed": "Bootstrap fehlgeschlagen: {0}",
+ "bootstrap_failed_unknown": "Bootstrap fehlgeschlagen",
+ "chain_failure": "Kettenfehler: {0}",
+ "backlog_count": "Journal-Rückstand: {0}",
+ "legacy_conflict": "Konflikt mit Legacy-Vault erkannt"
+ },
"skill_create_dialog": {
"title": "Skill erstellen",
"subtitle": "Beschreibe, was der Skill tun soll — per KI entwerfen oder das Formular selbst ausfüllen.",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.json
index d4750fc795..dc49249b16 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json
@@ -2140,6 +2140,21 @@
"manual_b": "file into",
"manual_c": "yourself at any time."
},
+ "wiki_health": {
+ "checking": "Checking wiki health…",
+ "unavailable": "Wiki health check unavailable",
+ "vault_prefix": "Vault: {0}",
+ "vault_unknown": "Vault path unknown",
+ "last_write_ok": "Last write: {0} · ok",
+ "last_write_failed": "Last write failed: {0}",
+ "last_write_failed_unknown": "Last write failed",
+ "no_writes_yet": "No writes recorded yet",
+ "bootstrap_failed": "Bootstrap failed: {0}",
+ "bootstrap_failed_unknown": "Bootstrap failed",
+ "chain_failure": "Chain failure: {0}",
+ "backlog_count": "Journal backlog: {0}",
+ "legacy_conflict": "Legacy vault conflict detected"
+ },
"skill_create_dialog": {
"title": "Create skill",
"subtitle": "Describe what the skill should do — draft it with AI or fill the form yourself.",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.json
index 366eae542c..af27a0a0b1 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json
@@ -2139,6 +2139,21 @@
"manual_b": "en",
"manual_c": "tú mismo en cualquier momento."
},
+ "wiki_health": {
+ "checking": "Comprobando el estado del wiki…",
+ "unavailable": "Comprobación del estado del wiki no disponible",
+ "vault_prefix": "Bóveda: {0}",
+ "vault_unknown": "Ruta de la bóveda desconocida",
+ "last_write_ok": "Última escritura: {0} · ok",
+ "last_write_failed": "Última escritura fallida: {0}",
+ "last_write_failed_unknown": "Última escritura fallida",
+ "no_writes_yet": "Aún no se han registrado escrituras",
+ "bootstrap_failed": "Bootstrap fallido: {0}",
+ "bootstrap_failed_unknown": "Bootstrap fallido",
+ "chain_failure": "Fallo en la cadena: {0}",
+ "backlog_count": "Retraso del journal: {0}",
+ "legacy_conflict": "Conflicto con la bóveda heredada detectado"
+ },
"skill_create_dialog": {
"title": "Crear habilidad",
"subtitle": "Describe qué debe hacer la habilidad: créala con IA o rellena el formulario tú mismo.",
diff --git a/jarvis/ui/web/frontend/src/lib/wikiApi.ts b/jarvis/ui/web/frontend/src/lib/wikiApi.ts
index 8b63513263..cd52a874f3 100644
--- a/jarvis/ui/web/frontend/src/lib/wikiApi.ts
+++ b/jarvis/ui/web/frontend/src/lib/wikiApi.ts
@@ -103,6 +103,30 @@ export interface WikiSearchResponse {
error?: string;
}
+export interface WikiHealthLastWrite {
+ ts: number;
+ ok: boolean;
+ pages: string[];
+ error: string | null;
+ source: string;
+}
+
+export interface WikiHealthLastChainFailure {
+ ts: number;
+ detail: string;
+}
+
+export interface WikiHealthSnapshot {
+ bootstrap_ok: boolean | null;
+ bootstrap_error: string | null;
+ vault_root: string | null;
+ vault_root_source: string | null;
+ vault_legacy_conflict: boolean;
+ last_write: WikiHealthLastWrite | null;
+ last_chain_failure: WikiHealthLastChainFailure | null;
+ journal_backlog: number;
+}
+
async function getJson<T>(url: string): Promise<T> {
const res = await fetch(url);
if (!res.ok) {
@@ -137,3 +161,26 @@ export async function fetchWikiSearch(
const params = new URLSearchParams({ q: query, k: String(k) });
return getJson<WikiSearchResponse>(`/api/wiki/search?${params.toString()}`);
}
+
+/**
+ * Fetch the wiki subsystem's own health snapshot (bootstrap state, last
+ * write outcome, journal backlog). Unlike the other fetchers here, this one
+ * swallows both HTTP-level and network-level failures and returns `null`
+ * instead of throwing — it is polled on a timer by `WikiHealthStrip`
+ * (`WikiView.tsx`), and a transient network blip during polling must not
+ * surface as an unhandled rejection. Callers treat `null` as "unknown", the
+ * same way the status strip treats a not-yet-resolved health check.
+ */
+export async function fetchWikiHealth(): Promise<WikiHealthSnapshot | null> {
+ try {
+ const res = await fetch("/api/wiki/health");
+ if (!res.ok) return null;
+ const body = (await res.json()) as {
+ ok: boolean;
+ health?: WikiHealthSnapshot;
+ };
+ return body.ok && body.health ? body.health : null;
+ } catch {
+ return null;
+ }
+}
diff --git a/jarvis/ui/web/frontend/src/views/WikiView.test.tsx b/jarvis/ui/web/frontend/src/views/WikiView.test.tsx
index d56faf0a4e..6f007aab36 100644
--- a/jarvis/ui/web/frontend/src/views/WikiView.test.tsx
+++ b/jarvis/ui/web/frontend/src/views/WikiView.test.tsx
@@ -16,6 +16,7 @@ import type {
WikiPageResponse,
WikiTreeResponse,
WikiBacklinksResponse,
+ WikiHealthSnapshot,
} from "@/lib/wikiApi";
function freshClient(): QueryClient {
@@ -200,6 +201,80 @@ describe("WikiView — populated tree", () => {
});
});
+describe("WikiView — health strip", () => {
+ const HEALTHY_HEALTH: WikiHealthSnapshot = {
+ bootstrap_ok: true,
+ bootstrap_error: null,
+ vault_root: "wiki/obsidian-vault",
+ vault_root_source: "config",
+ vault_legacy_conflict: false,
+ last_write: {
+ ts: 1750000000,
+ ok: true,
+ pages: ["ruben"],
+ error: null,
+ source: "curator",
+ },
+ last_chain_failure: null,
+ journal_backlog: 0,
+ };
+
+ const FAILED_HEALTH: WikiHealthSnapshot = {
+ bootstrap_ok: true,
+ bootstrap_error: null,
+ vault_root: "wiki/obsidian-vault",
+ vault_root_source: "config",
+ vault_legacy_conflict: false,
+ last_write: {
+ ts: 1750000000,
+ ok: false,
+ pages: [],
+ error: "Permission denied writing entities/ruben.md",
+ source: "curator",
+ },
+ last_chain_failure: null,
+ journal_backlog: 3,
+ };
+
+ it("renders the vault path for a healthy snapshot", async () => {
+ installFetchMock({
+ "/api/wiki/tree": () => EMPTY_TREE,
+ "/api/wiki/health": () => ({ ok: true, health: HEALTHY_HEALTH }),
+ });
+ renderWithClient(<WikiView />);
+
+ await waitFor(() => {
+ expect(screen.getByTestId("wiki-health-strip")).toBeDefined();
+ });
+ await waitFor(() => {
+ expect(screen.getByTestId("wiki-health-vault").textContent).toContain(
+ "wiki/obsidian-vault",
+ );
+ });
+ expect(
+ screen.getByTestId("wiki-health-dot").getAttribute("data-visual"),
+ ).toBe("green");
+ });
+
+ it("renders the error text for a failed last write, and the backlog count", async () => {
+ installFetchMock({
+ "/api/wiki/tree": () => EMPTY_TREE,
+ "/api/wiki/health": () => ({ ok: true, health: FAILED_HEALTH }),
+ });
+ renderWithClient(<WikiView />);
+
+ await waitFor(() => {
+ expect(screen.getByTestId("wiki-health-write").textContent).toContain(
+ "Permission denied writing entities/ruben.md",
+ );
+ });
+ expect(
+ screen.getByTestId("wiki-health-dot").getAttribute("data-visual"),
+ ).toBe("red");
+ expect(screen.getByTestId("wiki-health-backlog").textContent).toContain("3");
+ });
+});
+
describe("PageRenderer — wikilink behaviour", () => {
it("preprocessWikilinks rewrites [[slug]] / [[folder/slug]] / [[slug|label]]", () => {
expect(preprocessWikilinks("see [[ruben]] here")).toBe(
diff --git a/jarvis/ui/web/frontend/src/views/WikiView.tsx b/jarvis/ui/web/frontend/src/views/WikiView.tsx
index a35a5daa11..c644b3e9be 100644
--- a/jarvis/ui/web/frontend/src/views/WikiView.tsx
+++ b/jarvis/ui/web/frontend/src/views/WikiView.tsx
@@ -21,7 +21,11 @@ import { ViewHeader } from "@/views/ChatsView";
import { cn } from "@/lib/utils";
import { useT } from "@/i18n";
import { useEventStore } from "@/store/events";
-import { fetchWikiTree } from "@/lib/wikiApi";
+import {
+ fetchWikiHealth,
+ fetchWikiTree,
+ type WikiHealthSnapshot,
+} from "@/lib/wikiApi";
import { TreeSidebar } from "@/components/wiki/TreeSidebar";
import { PageRenderer } from "@/components/wiki/PageRenderer";
@@ -69,6 +73,15 @@ export function WikiView(): JSX.Element {
const totalPages = stats?.total_pages ?? 0;
const totalLinks = stats?.total_links ?? 0;
+ // Wiki subsystem health (spec A5): polled on mount + every 30 s so the
+ // "honest, not silent" status strip stays live without a manual refresh.
+ const healthQuery = useQuery({
+ queryKey: ["wiki", "health"],
+ queryFn: fetchWikiHealth,
+ refetchInterval: 30_000,
+ staleTime: 5_000,
+ });
+
// When a slug is selected (via tree click, graph click, or wikilink),
// automatically swap to the page tab.
useEffect(() => {
@@ -169,6 +182,8 @@ export function WikiView(): JSX.Element {
</div>
</div>
+ <WikiHealthStrip health={healthQuery.data} isLoading={healthQuery.isLoading} />
+
{dialogOpen && setupHint && (
<ObsidianSetupDialog
open={dialogOpen}
@@ -285,6 +300,164 @@ export function WikiView(): JSX.Element {
);
}
+type WikiHealthVisual = "green" | "amber" | "red" | "unknown";
+
+const HEALTH_DOT_STYLE: Record<WikiHealthVisual, string> = {
+ green: "bg-[#5bd4a4]",
+ amber: "bg-[#ffb84d]",
+ red: "bg-destructive",
+ unknown: "bg-muted-foreground/40",
+};
+
+function classifyWikiHealth(health: WikiHealthSnapshot): WikiHealthVisual {
+ if (
+ health.bootstrap_ok === false ||
+ health.last_write?.ok === false ||
+ health.last_chain_failure
+ ) {
+ return "red";
+ }
+ if (health.journal_backlog > 0 || health.vault_legacy_conflict) {
+ return "amber";
+ }
+ // At this point `last_write?.ok === false` and `last_chain_failure` are
+ // both already ruled out by the guard above, so the remaining green
+ // condition collapses to `bootstrap_ok` alone.
+ if (health.bootstrap_ok) {
+ return "green";
+ }
+ // bootstrap_ok is null (never run yet) and nothing else flagged a problem —
+ // neither a clean pass nor a known failure, so stay neutral rather than
+ // claim "green" for a state we haven't actually verified.
+ return "unknown";
+}
+
+function describeWikiWriteStatus(
+ health: WikiHealthSnapshot,
+ t: (key: string) => string,
+): string {
+ if (health.bootstrap_ok === false) {
+ return health.bootstrap_error
+ ? t("wiki_health.bootstrap_failed").replace("{0}", health.bootstrap_error)
+ : t("wiki_health.bootstrap_failed_unknown");
+ }
+ if (health.last_chain_failure) {
+ return t("wiki_health.chain_failure").replace(
+ "{0}",
+ health.last_chain_failure.detail,
+ );
+ }
+ if (health.last_write?.ok === false) {
+ return health.last_write.error
+ ? t("wiki_health.last_write_failed").replace("{0}", health.last_write.error)
+ : t("wiki_health.last_write_failed_unknown");
+ }
+ if (health.last_write?.ok) {
+ const page = health.last_write.pages.join(", ") || health.last_write.source;
+ return t("wiki_health.last_write_ok").replace("{0}", page);
+ }
+ return t("wiki_health.no_writes_yet");
+}
+
+/**
+ * Compact status strip at the top of the Wiki tab (spec A5). Polled by the
+ * caller on a timer; this component only renders whatever snapshot it was
+ * given. "Honest, not silent": a failed bootstrap, a failed write, or a
+ * growing journal backlog shows up here instead of failing quietly.
+ */
+function WikiHealthStrip({
+ health,
+ isLoading,
+}: {
+ health: WikiHealthSnapshot | null | undefined;
+ isLoading: boolean;
+}): JSX.Element {
+ const t = useT();
+
+ if (isLoading) {
+ return (
+ <div
+ className="flex items-center gap-2 border-b border-border bg-card/30 px-4 py-2 text-xs text-muted-foreground"
+ data-testid="wiki-health-strip"
+ >
+ <span
+ className="h-2 w-2 shrink-0 animate-pulse rounded-full bg-muted-foreground/40"
+ data-testid="wiki-health-dot"
+ data-visual="loading"
+ aria-hidden
+ />
+ <span data-testid="wiki-health-checking">{t("wiki_health.checking")}</span>
+ </div>
+ );
+ }
+
+ if (!health) {
+ return (
+ <div
+ className="flex items-center gap-2 border-b border-border bg-card/30 px-4 py-2 text-xs text-muted-foreground"
+ data-testid="wiki-health-strip"
+ >
+ <span
+ className="h-2 w-2 shrink-0 rounded-full bg-muted-foreground/40"
+ data-testid="wiki-health-dot"
+ data-visual="unknown"
+ aria-hidden
+ />
+ <span data-testid="wiki-health-unavailable">{t("wiki_health.unavailable")}</span>
+ </div>
+ );
+ }
+
+ const visual = classifyWikiHealth(health);
+ const vaultText = health.vault_root
+ ? t("wiki_health.vault_prefix").replace("{0}", health.vault_root)
+ : t("wiki_health.vault_unknown");
+ const writeText = describeWikiWriteStatus(health, t);
+
+ return (
+ <div
+ className="flex flex-wrap items-center gap-x-3 gap-y-1 border-b border-border bg-card/30 px-4 py-2 text-xs text-muted-foreground"
+ data-testid="wiki-health-strip"
+ >
+ <span
+ className={cn("h-2 w-2 shrink-0 rounded-full", HEALTH_DOT_STYLE[visual])}
+ data-testid="wiki-health-dot"
+ data-visual={visual}
+ aria-hidden
+ />
+ <span data-testid="wiki-health-vault" className="truncate">
+ {vaultText}
+ </span>
+ <span aria-hidden>·</span>
+ <span
+ data-testid="wiki-health-write"
+ className={visual === "red" ? "text-destructive" : undefined}
+ >
+ {writeText}
+ </span>
+ {health.journal_backlog > 0 && (
+ <span
+ data-testid="wiki-health-backlog"
+ className="rounded-full border border-[#ffb84d]/40 bg-[#ffb84d]/10 px-1.5 py-0.5 text-[#ffb84d]"
+ >
+ {t("wiki_health.backlog_count").replace(
+ "{0}",
+ String(health.journal_backlog),
+ )}
+ </span>
+ )}
+ {health.vault_legacy_conflict && (
+ <span
+ data-testid="wiki-health-legacy-conflict"
+ className="rounded-full border border-[#ffb84d]/40 bg-[#ffb84d]/10 px-1.5 py-0.5 text-[#ffb84d]"
+ >
+ {t("wiki_health.legacy_conflict")}
+ </span>
+ )}
+ </div>
+ );
+}
+
function TabButton({
active,
onClick,