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(ultrawiki): Wiki-section Ultra mode UI — toggle, wizard, slots, sources, ask

Ruben Lütke631d4bdd7a27
diff --git a/jarvis/ui/web/frontend/src/components/ultrawiki/ActivationWizard.test.tsx b/jarvis/ui/web/frontend/src/components/ultrawiki/ActivationWizard.test.tsx
new file mode 100644
index 0000000000..2e9bd5db4c
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/ultrawiki/ActivationWizard.test.tsx
@@ -0,0 +1,155 @@
+/**
+ * ActivationWizard tests — the deliberate embedding choice (decision D-3).
+ *
+ * Pins that the wizard refuses to advance past the embedding step while the
+ * selected backend is not ready (the honest reason is shown), because
+ * activation would 409 on the backend anyway.
+ */
+import { afterEach, describe, expect, it, vi } from "vitest";
+import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+
+import { ActivationWizard } from "@/components/ultrawiki/ActivationWizard";
+
+function renderWithClient(node: React.ReactNode) {
+ const client = new QueryClient({
+ defaultOptions: { queries: { retry: false, gcTime: 0, staleTime: 0 } },
+ });
+ return render(
+ <QueryClientProvider client={client}>{node}</QueryClientProvider>,
+ );
+}
+
+const PROVIDERS_NONE_READY = {
+ embedding: [
+ {
+ name: "ollama",
+ ready: false,
+ reason: "Ollama is not reachable at http://127.0.0.1:11434",
+ default_model: "bge-m3",
+ },
+ {
+ name: "gemini",
+ ready: false,
+ reason: "no GEMINI_API_KEY is configured",
+ default_model: "gemini-embedding-001",
+ },
+ ],
+ rerank: [],
+ db_backends: [
+ {
+ name: "sqlite",
+ ready: true,
+ reason: "",
+ detail: "Local file under the data directory.",
+ },
+ {
+ name: "postgres",
+ ready: false,
+ secret_present: false,
+ reason: "no 'ultrawiki_db_url' connection string is saved",
+ detail: "PostgreSQL via connection string.",
+ },
+ ],
+};
+
+function installFetchMock(routes: Record<string, () => unknown>) {
+ const fetchMock = vi.fn(async (input: RequestInfo | URL) => {
+ const url = String(input);
+ for (const prefix of Object.keys(routes)) {
+ if (url.startsWith(prefix)) {
+ return {
+ ok: true,
+ status: 200,
+ statusText: "OK",
+ json: async () => routes[prefix](),
+ } as Response;
+ }
+ }
+ throw new Error(`unexpected fetch ${url}`);
+ });
+ (globalThis as unknown as { fetch: typeof fetch }).fetch =
+ fetchMock as unknown as typeof fetch;
+ return fetchMock;
+}
+
+afterEach(() => {
+ cleanup();
+ vi.restoreAllMocks();
+});
+
+describe("ActivationWizard — not-ready embedding backend", () => {
+ it("blocks Next on the embedding step while the selected backend is not ready", async () => {
+ installFetchMock({
+ "/api/ultrawiki/providers": () => PROVIDERS_NONE_READY,
+ });
+ renderWithClient(
+ <ActivationWizard onClose={vi.fn()} onActivated={vi.fn()} />,
+ );
+
+ // Step 1 (storage): SQLite is ready and preselected — Next advances.
+ await waitFor(() => {
+ expect(screen.getByTestId("ultrawiki-wizard-storage-sqlite")).toBeDefined();
+ });
+ fireEvent.click(screen.getByTestId("ultrawiki-wizard-next"));
+
+ // Step 2 (embedding): nothing selected yet → Next already blocked, and
+ // the none-ready warning is on show.
+ await waitFor(() => {
+ expect(
+ screen.getByTestId("ultrawiki-wizard-embedding-ollama"),
+ ).toBeDefined();
+ });
+ expect(screen.getByTestId("ultrawiki-wizard-none-ready")).toBeDefined();
+ const next = screen.getByTestId("ultrawiki-wizard-next") as HTMLButtonElement;
+ expect(next.disabled).toBe(true);
+
+ // Selecting a NOT-ready backend keeps Next blocked and shows the honest
+ // per-card reason.
+ fireEvent.click(screen.getByTestId("ultrawiki-wizard-embedding-ollama"));
+ expect(
+ screen.getByTestId("ultrawiki-wizard-embedding-ollama-reason").textContent,
+ ).toContain("Ollama is not reachable");
+ expect(
+ (screen.getByTestId("ultrawiki-wizard-next") as HTMLButtonElement).disabled,
+ ).toBe(true);
+ });
+
+ it("advances past the embedding step once a READY backend is selected", async () => {
+ installFetchMock({
+ "/api/ultrawiki/providers": () => ({
+ ...PROVIDERS_NONE_READY,
+ embedding: [
+ {
+ name: "gemini",
+ ready: true,
+ reason: "",
+ default_model: "gemini-embedding-001",
+ },
+ ],
+ }),
+ });
+ renderWithClient(
+ <ActivationWizard onClose={vi.fn()} onActivated={vi.fn()} />,
+ );
+
+ await waitFor(() => {
+ expect(screen.getByTestId("ultrawiki-wizard-storage-sqlite")).toBeDefined();
+ });
+ fireEvent.click(screen.getByTestId("ultrawiki-wizard-next"));
+
+ await waitFor(() => {
+ expect(
+ screen.getByTestId("ultrawiki-wizard-embedding-gemini"),
+ ).toBeDefined();
+ });
+ fireEvent.click(screen.getByTestId("ultrawiki-wizard-embedding-gemini"));
+ const next = screen.getByTestId("ultrawiki-wizard-next") as HTMLButtonElement;
+ expect(next.disabled).toBe(false);
+
+ fireEvent.click(next);
+ await waitFor(() => {
+ expect(screen.getByTestId("ultrawiki-wizard-distill")).toBeDefined();
+ });
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/components/ultrawiki/ActivationWizard.tsx b/jarvis/ui/web/frontend/src/components/ultrawiki/ActivationWizard.tsx
new file mode 100644
index 0000000000..81653f31d6
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/ultrawiki/ActivationWizard.tsx
@@ -0,0 +1,601 @@
+/**
+ * One-time UltraWiki activation wizard (design doc 04, decisions D-3/D-6).
+ *
+ * Four steps — the one moment where the semi-permanent choices are made
+ * consciously:
+ * 1. Storage: SQLite (default, zero setup) or Postgres via the saved
+ * `ultrawiki_db_url` secret. The connection string is NEVER entered
+ * here — the card links to the API-Keys view where secrets live.
+ * 2. Embedding: option cards from `GET /api/ultrawiki/providers` with each
+ * backend's honest ready/reason, plus the plain local-vs-cloud
+ * trade-off. A not-ready pick blocks Next — activation would 409 anyway.
+ * 3. Distillation + rerank (both optional, both safe to change later). The
+ * distill default follows the embedding privacy stance (local embedding
+ * → local distillation) but is independently overridable.
+ * 4. Review → `POST /api/ultrawiki/activate` → show the backend's
+ * `next_steps` (nothing is read before sources are approved).
+ */
+import { useState } from "react";
+import {
+ AlertTriangle,
+ Check,
+ Cloud,
+ Database,
+ HardDrive,
+ Loader2,
+ X,
+} from "lucide-react";
+import { useQuery } from "@tanstack/react-query";
+
+import { Button } from "@/components/ui/button";
+import { cn } from "@/lib/utils";
+import { useT } from "@/i18n";
+import { useEventStore } from "@/store/events";
+import {
+ activateUltraWiki,
+ fetchUltraWikiProviders,
+ type UltraWikiProviderOption,
+} from "@/lib/ultrawikiApi";
+
+type StepId = "storage" | "embedding" | "optional" | "review";
+
+const STEPS: readonly StepId[] = ["storage", "embedding", "optional", "review"];
+
+const STEP_LABEL_KEY: Record<StepId, string> = {
+ storage: "ultrawiki.wizard.step_storage",
+ embedding: "ultrawiki.wizard.step_embedding",
+ optional: "ultrawiki.wizard.step_optional",
+ review: "ultrawiki.wizard.step_review",
+};
+
+export function ActivationWizard({
+ onClose,
+ onActivated,
+}: {
+ onClose: () => void;
+ onActivated: () => void;
+}): JSX.Element {
+ const t = useT();
+ const setActiveSection = useEventStore((s) => s.setActiveSection);
+
+ const [step, setStep] = useState<StepId>("storage");
+ const [dbBackend, setDbBackend] = useState<"sqlite" | "postgres">("sqlite");
+ const [embedding, setEmbedding] = useState<string>("");
+ const [embeddingModel, setEmbeddingModel] = useState<string>("");
+ // null = untouched → step 3 seeds the privacy-stance default on entry.
+ const [distill, setDistill] = useState<string | null>(null);
+ const [rerank, setRerank] = useState<string>("");
+ const [activating, setActivating] = useState(false);
+ const [activateError, setActivateError] = useState<string>("");
+ const [nextSteps, setNextSteps] = useState<string>("");
+
+ const providersQuery = useQuery({
+ queryKey: ["ultrawiki", "providers"],
+ queryFn: fetchUltraWikiProviders,
+ staleTime: 5_000,
+ });
+ const providers = providersQuery.data;
+
+ const stepIndex = STEPS.indexOf(step);
+ const selectedEmbedding = (providers?.embedding ?? []).find(
+ (row) => row.name === embedding,
+ );
+ const postgresRow = (providers?.db_backends ?? []).find(
+ (row) => row.name === "postgres",
+ );
+ const anyEmbeddingReady = (providers?.embedding ?? []).some(
+ (row) => row.ready,
+ );
+
+ // The Next gate per step: storage blocks on a not-ready Postgres pick,
+ // embedding blocks until a READY backend is chosen (the deliberate D-3 choice).
+ const nextBlocked =
+ (step === "storage" && dbBackend === "postgres" && !postgresRow?.ready) ||
+ (step === "embedding" && (!selectedEmbedding || !selectedEmbedding.ready));
+
+ function goNext() {
+ if (nextBlocked) return;
+ const next = STEPS[stepIndex + 1];
+ if (!next) return;
+ if (next === "optional" && distill === null) {
+ // Suggest matching the embedding privacy stance (design doc 04 step 3):
+ // a local (Ollama) embedding defaults to local distillation, cloud → auto.
+ setDistill(embedding === "ollama" ? "ollama" : "");
+ }
+ setStep(next);
+ }
+
+ function goBack() {
+ const prev = STEPS[stepIndex - 1];
+ if (prev) setStep(prev);
+ }
+
+ async function handleActivate() {
+ setActivating(true);
+ setActivateError("");
+ try {
+ const result = await activateUltraWiki({
+ db_backend: dbBackend,
+ embedding_provider: embedding,
+ embedding_model: embeddingModel.trim(),
+ distill_provider: distill ?? "",
+ rerank_provider: rerank,
+ });
+ setNextSteps(result.next_steps || "");
+ } catch (e) {
+ setActivateError((e as Error).message);
+ } finally {
+ setActivating(false);
+ }
+ }
+
+ const activated = nextSteps !== "";
+
+ return (
+ <div
+ className="fixed inset-0 z-[70] flex items-center justify-center bg-background/80 backdrop-blur-sm"
+ role="dialog"
+ aria-modal="true"
+ aria-labelledby="ultrawiki-wizard-title"
+ data-testid="ultrawiki-activation-wizard"
+ onClick={(e) => {
+ if (e.target === e.currentTarget && !activating) onClose();
+ }}
+ >
+ <div
+ className="relative flex max-h-[85vh] w-full max-w-2xl flex-col overflow-y-auto rounded-2xl border border-border bg-card p-6 shadow-2xl"
+ onClick={(e) => e.stopPropagation()}
+ >
+ <button
+ type="button"
+ onClick={onClose}
+ className="absolute right-3 top-3 rounded-md p-1 text-muted-foreground hover:bg-secondary/40 hover:text-foreground"
+ aria-label={t("ultrawiki.wizard.close")}
+ data-testid="ultrawiki-wizard-close"
+ >
+ <X className="h-4 w-4" />
+ </button>
+
+ <h2
+ id="ultrawiki-wizard-title"
+ className="text-base font-semibold text-foreground"
+ >
+ {t("ultrawiki.wizard.title")}
+ </h2>
+ <p className="mt-1 text-xs leading-relaxed text-muted-foreground">
+ {t("ultrawiki.wizard.subtitle")}
+ </p>
+
+ {/* Step rail */}
+ <ol className="mt-4 flex flex-wrap items-center gap-2 text-[11px]">
+ {STEPS.map((id, i) => (
+ <li
+ key={id}
+ className={cn(
+ "flex items-center gap-1.5 rounded-full border px-2.5 py-1",
+ i === stepIndex
+ ? "border-primary/50 bg-primary/10 text-foreground"
+ : i < stepIndex
+ ? "border-border text-muted-foreground"
+ : "border-border/60 text-muted-foreground/60",
+ )}
+ >
+ {i < stepIndex && <Check className="h-3 w-3" aria-hidden />}
+ {t(STEP_LABEL_KEY[id])}
+ </li>
+ ))}
+ </ol>
+
+ <div className="mt-4 min-h-0 flex-1">
+ {activated ? (
+ <div className="space-y-3" data-testid="ultrawiki-wizard-done">
+ <p className="text-sm leading-relaxed text-foreground">
+ {nextSteps}
+ </p>
+ <Button size="sm" onClick={onActivated}>
+ {t("ultrawiki.wizard.done")}
+ </Button>
+ </div>
+ ) : providersQuery.isLoading ? (
+ <div className="flex items-center gap-2 py-8 text-sm text-muted-foreground">
+ <Loader2 className="h-4 w-4 animate-spin" aria-hidden />
+ {t("ultrawiki.panel.loading")}
+ </div>
+ ) : providersQuery.isError || !providers ? (
+ <p className="py-6 text-sm text-destructive" role="alert">
+ {t("ultrawiki.panel.status_unavailable")}
+ </p>
+ ) : (
+ <>
+ {step === "storage" && (
+ <StorageStep
+ dbBackend={dbBackend}
+ onSelect={setDbBackend}
+ options={providers.db_backends}
+ onOpenApiKeys={() => setActiveSection("apikeys")}
+ />
+ )}
+ {step === "embedding" && (
+ <EmbeddingStep
+ options={providers.embedding}
+ selected={embedding}
+ onSelect={(name, defaultModel) => {
+ setEmbedding(name);
+ setEmbeddingModel(defaultModel);
+ }}
+ anyReady={anyEmbeddingReady}
+ />
+ )}
+ {step === "optional" && (
+ <OptionalStep
+ distill={distill ?? ""}
+ onDistill={setDistill}
+ rerank={rerank}
+ onRerank={setRerank}
+ rerankOptions={providers.rerank}
+ />
+ )}
+ {step === "review" && (
+ <ReviewStep
+ dbBackend={dbBackend}
+ embedding={embedding}
+ embeddingModel={
+ embeddingModel.trim() ||
+ selectedEmbedding?.default_model ||
+ ""
+ }
+ distill={distill ?? ""}
+ rerank={rerank}
+ error={activateError}
+ />
+ )}
+ </>
+ )}
+ </div>
+
+ {!activated && !providersQuery.isLoading && providers && (
+ <div className="mt-5 flex items-center justify-between border-t border-border pt-4">
+ <Button
+ variant="outline"
+ size="sm"
+ onClick={goBack}
+ disabled={stepIndex === 0 || activating}
+ >
+ {t("ultrawiki.wizard.back")}
+ </Button>
+ {step === "review" ? (
+ <Button
+ size="sm"
+ onClick={() => void handleActivate()}
+ disabled={activating}
+ data-testid="ultrawiki-wizard-activate"
+ >
+ {activating && (
+ <Loader2 className="mr-1.5 h-3.5 w-3.5 animate-spin" aria-hidden />
+ )}
+ {t(
+ activating
+ ? "ultrawiki.wizard.activating"
+ : "ultrawiki.wizard.activate",
+ )}
+ </Button>
+ ) : (
+ <Button
+ size="sm"
+ onClick={goNext}
+ disabled={nextBlocked}
+ data-testid="ultrawiki-wizard-next"
+ >
+ {t("ultrawiki.wizard.next")}
+ </Button>
+ )}
+ </div>
+ )}
+ </div>
+ </div>
+ );
+}
+
+function StorageStep({
+ dbBackend,
+ onSelect,
+ options,
+ onOpenApiKeys,
+}: {
+ dbBackend: "sqlite" | "postgres";
+ onSelect: (backend: "sqlite" | "postgres") => void;
+ options: Array<{ name: string; ready: boolean; reason: string; detail: string }>;
+ onOpenApiKeys: () => void;
+}): JSX.Element {
+ const t = useT();
+ return (
+ <div className="space-y-3">
+ <p className="text-sm text-muted-foreground">
+ {t("ultrawiki.wizard.storage_intro")}
+ </p>
+ <ul className="space-y-2">
+ {options.map((option) => {
+ const isPostgres = option.name === "postgres";
+ const selected = dbBackend === option.name;
+ return (
+ <li key={option.name}>
+ <button
+ type="button"
+ onClick={() => onSelect(option.name as "sqlite" | "postgres")}
+ aria-pressed={selected}
+ data-testid={`ultrawiki-wizard-storage-${option.name}`}
+ className={cn(
+ "w-full rounded-xl border p-3 text-left transition-colors",
+ selected
+ ? "border-primary/60 bg-primary/5 ring-1 ring-primary/40"
+ : "border-border hover:bg-secondary/30",
+ )}
+ >
+ <span className="flex items-center gap-2 text-sm font-medium text-foreground">
+ {isPostgres ? (
+ <Database className="h-4 w-4 text-primary" aria-hidden />
+ ) : (
+ <HardDrive className="h-4 w-4 text-primary" aria-hidden />
+ )}
+ {t(
+ isPostgres
+ ? "ultrawiki.slots.storage_postgres"
+ : "ultrawiki.slots.storage_sqlite",
+ )}
+ </span>
+ <span className="mt-1 block text-xs leading-relaxed text-muted-foreground">
+ {option.detail}
+ </span>
+ {!option.ready && (
+ <span
+ className="mt-1.5 flex items-start gap-1.5 text-xs text-[#ffb84d]"
+ data-testid="ultrawiki-wizard-storage-not-ready"
+ >
+ <AlertTriangle className="mt-0.5 h-3 w-3 shrink-0" aria-hidden />
+ {option.reason}
+ </span>
+ )}
+ </button>
+ </li>
+ );
+ })}
+ </ul>
+ {dbBackend === "postgres" && (
+ <div className="space-y-2 rounded-lg border border-border/60 bg-muted/20 p-3 text-xs text-muted-foreground">
+ {/* The connection string is a secret: it lives in the secret chain,
+ never in this wizard (AP-2/AP-12). */}
+ <p>{t("ultrawiki.slots.storage_postgres_hint")}</p>
+ <Button variant="outline" size="sm" onClick={onOpenApiKeys}>
+ {t("ultrawiki.slots.open_api_keys")}
+ </Button>
+ </div>
+ )}
+ </div>
+ );
+}
+
+function EmbeddingStep({
+ options,
+ selected,
+ onSelect,
+ anyReady,
+}: {
+ options: UltraWikiProviderOption[];
+ selected: string;
+ onSelect: (name: string, defaultModel: string) => void;
+ anyReady: boolean;
+}): JSX.Element {
+ const t = useT();
+ return (
+ <div className="space-y-3">
+ <p className="text-sm text-muted-foreground">
+ {t("ultrawiki.wizard.embedding_intro")}
+ </p>
+ {/* The honest local-vs-cloud trade-off, stated plainly (design doc 04). */}
+ <p className="rounded-lg border border-border/60 bg-muted/20 p-3 text-xs leading-relaxed text-muted-foreground">
+ {t("ultrawiki.wizard.embedding_tradeoff")}
+ </p>
+ <p className="flex items-start gap-1.5 text-xs text-[#ffb84d]">
+ <AlertTriangle className="mt-0.5 h-3 w-3 shrink-0" aria-hidden />
+ {t("ultrawiki.wizard.embedding_permanent")}
+ </p>
+ {!anyReady && (
+ <p
+ className="text-xs text-destructive"
+ role="alert"
+ data-testid="ultrawiki-wizard-none-ready"
+ >
+ {t("ultrawiki.wizard.embedding_none_ready")}
+ </p>
+ )}
+ <ul className="grid gap-2 sm:grid-cols-2">
+ {options.map((option) => {
+ const isLocal = option.name === "ollama";
+ const isSelected = selected === option.name;
+ return (
+ <li key={option.name}>
+ <button
+ type="button"
+ onClick={() => onSelect(option.name, option.default_model ?? "")}
+ aria-pressed={isSelected}
+ data-testid={`ultrawiki-wizard-embedding-${option.name}`}
+ className={cn(
+ "h-full w-full rounded-xl border p-3 text-left transition-colors",
+ isSelected
+ ? "border-primary/60 bg-primary/5 ring-1 ring-primary/40"
+ : "border-border hover:bg-secondary/30",
+ !option.ready && "opacity-80",
+ )}
+ >
+ <span className="flex items-center justify-between gap-2">
+ <span className="text-sm font-medium text-foreground">
+ {option.name}
+ </span>
+ <span
+ className={cn(
+ "inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[10px]",
+ isLocal
+ ? "border-[#5bd4a4]/40 text-[#5bd4a4]"
+ : "border-border text-muted-foreground",
+ )}
+ >
+ {isLocal ? (
+ <HardDrive className="h-2.5 w-2.5" aria-hidden />
+ ) : (
+ <Cloud className="h-2.5 w-2.5" aria-hidden />
+ )}
+ {t(
+ isLocal
+ ? "ultrawiki.wizard.local_chip"
+ : "ultrawiki.wizard.cloud_chip",
+ )}
+ </span>
+ </span>
+ {option.default_model && (
+ <span className="mt-1 block text-xs text-muted-foreground">
+ {t("ultrawiki.wizard.default_model").replace(
+ "{0}",
+ option.default_model,
+ )}
+ </span>
+ )}
+ {!option.ready && (
+ <span
+ className="mt-1.5 block text-xs text-[#ffb84d]"
+ data-testid={`ultrawiki-wizard-embedding-${option.name}-reason`}
+ >
+ {t("ultrawiki.wizard.embedding_not_ready").replace(
+ "{0}",
+ option.reason,
+ )}
+ </span>
+ )}
+ </button>
+ </li>
+ );
+ })}
+ </ul>
+ </div>
+ );
+}
+
+function OptionalStep({
+ distill,
+ onDistill,
+ rerank,
+ onRerank,
+ rerankOptions,
+}: {
+ distill: string;
+ onDistill: (value: string) => void;
+ rerank: string;
+ onRerank: (value: string) => void;
+ rerankOptions: UltraWikiProviderOption[];
+}): JSX.Element {
+ const t = useT();
+ const selectCls =
+ "w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary/40";
+ return (
+ <div className="space-y-4">
+ <p className="text-sm text-muted-foreground">
+ {t("ultrawiki.wizard.optional_intro")}
+ </p>
+ <label className="block">
+ <span className="mb-1.5 block text-[10px] uppercase tracking-wider text-muted-foreground">
+ {t("ultrawiki.wizard.distill_label")}
+ </span>
+ <select
+ value={distill}
+ onChange={(e) => onDistill(e.target.value)}
+ className={selectCls}
+ data-testid="ultrawiki-wizard-distill"
+ >
+ <option value="">{t("ultrawiki.wizard.distill_auto")}</option>
+ <option value="ollama">{t("ultrawiki.wizard.distill_local")}</option>
+ </select>
+ <span className="mt-1 block text-[11px] text-muted-foreground">
+ {t("ultrawiki.wizard.distill_privacy_hint")}
+ </span>
+ </label>
+ <label className="block">
+ <span className="mb-1.5 block text-[10px] uppercase tracking-wider text-muted-foreground">
+ {t("ultrawiki.wizard.rerank_label")}
+ </span>
+ <select
+ value={rerank}
+ onChange={(e) => onRerank(e.target.value)}
+ className={selectCls}
+ data-testid="ultrawiki-wizard-rerank"
+ >
+ <option value="">{t("ultrawiki.wizard.rerank_off")}</option>
+ {rerankOptions.map((option) => (
+ <option
+ key={option.name}
+ value={option.name}
+ disabled={!option.ready}
+ >
+ {option.name}
+ {!option.ready
+ ? ` (${t("ultrawiki.slots.not_ready_suffix")})`
+ : ""}
+ </option>
+ ))}
+ </select>
+ </label>
+ </div>
+ );
+}
+
+function ReviewStep({
+ dbBackend,
+ embedding,
+ embeddingModel,
+ distill,
+ rerank,
+ error,
+}: {
+ dbBackend: string;
+ embedding: string;
+ embeddingModel: string;
+ distill: string;
+ rerank: string;
+ error: string;
+}): JSX.Element {
+ const t = useT();
+ const rows: Array<[string, string]> = [
+ [t("ultrawiki.wizard.review_storage"), dbBackend],
+ [
+ t("ultrawiki.wizard.review_embedding"),
+ embeddingModel ? `${embedding} · ${embeddingModel}` : embedding,
+ ],
+ [
+ t("ultrawiki.wizard.review_distill"),
+ distill || t("ultrawiki.wizard.auto"),
+ ],
+ [t("ultrawiki.wizard.review_rerank"), rerank || t("ultrawiki.wizard.off")],
+ ];
+ return (
+ <div className="space-y-3">
+ <p className="text-sm text-muted-foreground">
+ {t("ultrawiki.wizard.review_intro")}
+ </p>
+ <dl className="space-y-1.5 rounded-lg border border-border/60 bg-muted/20 p-3 text-sm">
+ {rows.map(([label, value]) => (
+ <div className="flex items-baseline justify-between gap-3" key={label}>
+ <dt className="text-xs text-muted-foreground">{label}</dt>
+ <dd className="font-mono text-xs text-foreground">{value}</dd>
+ </div>
+ ))}
+ </dl>
+ {error && (
+ <p
+ className="rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive"
+ role="alert"
+ data-testid="ultrawiki-wizard-error"
+ >
+ {t("ultrawiki.wizard.activate_failed").replace("{0}", error)}
+ </p>
+ )}
+ </div>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/components/ultrawiki/AskPanel.test.tsx b/jarvis/ui/web/frontend/src/components/ultrawiki/AskPanel.test.tsx
new file mode 100644
index 0000000000..f86292346b
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/ultrawiki/AskPanel.test.tsx
@@ -0,0 +1,139 @@
+/**
+ * AskPanel tests — hybrid-search results with citations.
+ *
+ * Pins that a submitted query hits `GET /api/ultrawiki/search`, and that a
+ * result row renders title, snippet, source, matched-by chips
+ * (keyword / semantic), timestamp, and the permalink as a clickable citation.
+ */
+import { afterEach, describe, expect, it, vi } from "vitest";
+import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+
+import { AskPanel } from "@/components/ultrawiki/AskPanel";
+import type { UltraWikiSearchHit } from "@/lib/ultrawikiApi";
+
+function renderWithClient(node: React.ReactNode) {
+ const client = new QueryClient({
+ defaultOptions: { queries: { retry: false, gcTime: 0, staleTime: 0 } },
+ });
+ return render(
+ <QueryClientProvider client={client}>{node}</QueryClientProvider>,
+ );
+}
+
+const HIT: UltraWikiSearchHit = {
+ item_id: 42,
+ source_id: "local-folder-abc123",
+ title: "Trip planning notes",
+ snippet: "The ferry to the island leaves at 09:30 on weekdays.",
+ permalink: "obsidian://open?path=notes%2Ftrip.md",
+ timestamp_utc: "2026-07-01T08:00:00Z",
+ score: 0.87,
+ matched_by: ["keyword", "vector"],
+};
+
+function installFetchMock(routes: Record<string, () => unknown>) {
+ const fetchMock = vi.fn(async (input: RequestInfo | URL) => {
+ const url = String(input);
+ for (const prefix of Object.keys(routes)) {
+ if (url.startsWith(prefix)) {
+ return {
+ ok: true,
+ status: 200,
+ statusText: "OK",
+ json: async () => routes[prefix](),
+ } as Response;
+ }
+ }
+ throw new Error(`unexpected fetch ${url}`);
+ });
+ (globalThis as unknown as { fetch: typeof fetch }).fetch =
+ fetchMock as unknown as typeof fetch;
+ return fetchMock;
+}
+
+afterEach(() => {
+ cleanup();
+ vi.restoreAllMocks();
+});
+
+describe("AskPanel — results with citations", () => {
+ it("submits a query and renders the hit with matched_by chips and permalink", async () => {
+ const fetchMock = installFetchMock({
+ "/api/ultrawiki/search": () => ({
+ query: "ferry",
+ results: [HIT],
+ total: 1,
+ }),
+ });
+ renderWithClient(
+ <AskPanel
+ searchLegs={{
+ keyword: { available: true },
+ vector: { available: true, backend: "ollama", model: "bge-m3" },
+ }}
+ />,
+ );
+
+ fireEvent.change(screen.getByTestId("ultrawiki-ask-input"), {
+ target: { value: "ferry" },
+ });
+ fireEvent.click(screen.getByTestId("ultrawiki-ask-submit"));
+
+ await waitFor(() => {
+ expect(screen.getByTestId("ultrawiki-hit-42")).toBeDefined();
+ });
+ expect(fetchMock.mock.calls[0]?.[0]).toBe(
+ "/api/ultrawiki/search?q=ferry&k=20",
+ );
+
+ const row = screen.getByTestId("ultrawiki-hit-42");
+ expect(row.textContent).toContain("Trip planning notes");
+ expect(row.textContent).toContain("ferry to the island");
+ expect(row.textContent).toContain("local-folder-abc123");
+ expect(row.textContent).toContain("2026-07-01T08:00:00Z");
+
+ // matched_by chips: "keyword" and "vector" (rendered as "semantic").
+ expect(
+ screen.getByTestId("ultrawiki-matched-42-keyword").textContent,
+ ).toBe("keyword");
+ expect(
+ screen.getByTestId("ultrawiki-matched-42-vector").textContent,
+ ).toBe("semantic");
+
+ // The citation permalink is a real anchor pointing at the original.
+ const link = screen.getByTestId(
+ "ultrawiki-permalink-42",
+ ) as HTMLAnchorElement;
+ expect(link.tagName).toBe("A");
+ expect(link.getAttribute("href")).toBe(
+ "obsidian://open?path=notes%2Ftrip.md",
+ );
+ });
+
+ it("shows the honest degraded-leg reason when a query finds nothing", async () => {
+ installFetchMock({
+ "/api/ultrawiki/search": () => ({ query: "x", results: [], total: 0 }),
+ });
+ renderWithClient(
+ <AskPanel
+ searchLegs={{
+ keyword: { available: true },
+ vector: { available: false, reason: "no embedding provider is configured" },
+ }}
+ />,
+ );
+
+ fireEvent.change(screen.getByTestId("ultrawiki-ask-input"), {
+ target: { value: "anything" },
+ });
+ fireEvent.click(screen.getByTestId("ultrawiki-ask-submit"));
+
+ await waitFor(() => {
+ expect(screen.getByTestId("ultrawiki-ask-empty")).toBeDefined();
+ });
+ expect(screen.getByTestId("ultrawiki-ask-empty").textContent).toContain(
+ "no embedding provider is configured",
+ );
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/components/ultrawiki/AskPanel.tsx b/jarvis/ui/web/frontend/src/components/ultrawiki/AskPanel.tsx
new file mode 100644
index 0000000000..b80923396f
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/ultrawiki/AskPanel.tsx
@@ -0,0 +1,236 @@
+/**
+ * Ask view (design doc 04): the question box over the hybrid search
+ * (`GET /api/ultrawiki/search`). Every hit is a citation — title, snippet,
+ * source, matched-by chips (keyword / semantic), timestamp, and the
+ * permalink that deep-links back to where the item lives.
+ *
+ * Honesty: the legs line under the box states which retrieval legs are live
+ * (from `/status` `search_legs`), and the empty state repeats the reason a
+ * degraded leg gives instead of pretending the store is empty.
+ */
+import { useState } from "react";
+import { ExternalLink, Loader2, Search } from "lucide-react";
+import { useQuery } from "@tanstack/react-query";
+
+import { cn } from "@/lib/utils";
+import { useT } from "@/i18n";
+import {
+ searchUltraWiki,
+ type UltraWikiSearchHit,
+ type UltraWikiStatus,
+} from "@/lib/ultrawikiApi";
+
+export function AskPanel({
+ searchLegs,
+}: {
+ searchLegs: UltraWikiStatus["search_legs"] | undefined;
+}): JSX.Element {
+ const t = useT();
+ const [input, setInput] = useState("");
+ const [submitted, setSubmitted] = useState("");
+
+ const searchQuery = useQuery({
+ queryKey: ["ultrawiki", "search", submitted],
+ queryFn: () => searchUltraWiki(submitted),
+ enabled: submitted.length > 0,
+ retry: false,
+ staleTime: 5_000,
+ });
+
+ const results = searchQuery.data?.results ?? [];
+
+ return (
+ <div className="flex h-full min-h-0 flex-col p-4" data-testid="ultrawiki-ask-panel">
+ <form
+ className="flex items-center gap-2"
+ onSubmit={(e) => {
+ e.preventDefault();
+ setSubmitted(input.trim());
+ }}
+ >
+ <div className="relative flex-1">
+ <Search
+ className="pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"
+ aria-hidden
+ />
+ <input
+ type="search"
+ value={input}
+ onChange={(e) => setInput(e.target.value)}
+ placeholder={t("ultrawiki.ask.placeholder")}
+ aria-label={t("ultrawiki.ask.placeholder")}
+ data-testid="ultrawiki-ask-input"
+ className="w-full rounded-lg border border-border bg-background py-2 pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground/70 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary/40"
+ />
+ </div>
+ <button
+ type="submit"
+ disabled={input.trim().length === 0}
+ data-testid="ultrawiki-ask-submit"
+ className="rounded-lg border border-border bg-card px-3 py-2 text-sm text-foreground transition-colors hover:bg-secondary disabled:cursor-not-allowed disabled:opacity-50"
+ >
+ {t("ultrawiki.panel.tab_ask")}
+ </button>
+ </form>
+
+ <SearchLegsLine legs={searchLegs} />
+
+ <div className="mt-3 min-h-0 flex-1 overflow-y-auto">
+ {searchQuery.isFetching ? (
+ <div className="flex items-center gap-2 py-6 text-sm text-muted-foreground">
+ <Loader2 className="h-4 w-4 animate-spin" aria-hidden />
+ {t("ultrawiki.ask.searching")}
+ </div>
+ ) : searchQuery.isError ? (
+ <p
+ className="rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive"
+ role="alert"
+ data-testid="ultrawiki-ask-error"
+ >
+ {t("ultrawiki.ask.search_failed").replace(
+ "{0}",
+ (searchQuery.error as Error).message,
+ )}
+ </p>
+ ) : submitted && results.length === 0 && searchQuery.isSuccess ? (
+ <div
+ className="space-y-1.5 py-6 text-sm text-muted-foreground"
+ data-testid="ultrawiki-ask-empty"
+ >
+ <p>{t("ultrawiki.ask.no_results").replace("{0}", submitted)}</p>
+ {searchLegs?.vector?.available === false && (
+ <p className="text-xs">
+ {t("ultrawiki.ask.leg_vector_off").replace(
+ "{0}",
+ searchLegs.vector.reason ?? "",
+ )}
+ </p>
+ )}
+ </div>
+ ) : (
+ <ul className="space-y-2" data-testid="ultrawiki-ask-results">
+ {results.map((hit) => (
+ <ResultRow key={`${hit.item_id}-${hit.permalink}`} hit={hit} />
+ ))}
+ </ul>
+ )}
+ </div>
+ </div>
+ );
+}
+
+function SearchLegsLine({
+ legs,
+}: {
+ legs: UltraWikiStatus["search_legs"] | undefined;
+}): JSX.Element | null {
+ const t = useT();
+ if (!legs) return null;
+ const parts: Array<{ key: string; text: string; degraded: boolean }> = [];
+ if (legs.keyword?.available) {
+ parts.push({
+ key: "keyword",
+ text: t("ultrawiki.ask.leg_keyword_on"),
+ degraded: false,
+ });
+ }
+ if (legs.vector) {
+ parts.push(
+ legs.vector.available
+ ? { key: "vector", text: t("ultrawiki.ask.leg_vector_on"), degraded: false }
+ : {
+ key: "vector",
+ text: t("ultrawiki.ask.leg_vector_off").replace(
+ "{0}",
+ legs.vector.reason ?? "",
+ ),
+ degraded: true,
+ },
+ );
+ }
+ if (legs.rerank) {
+ parts.push({
+ key: "rerank",
+ text: t(
+ legs.rerank.available
+ ? "ultrawiki.ask.leg_rerank_on"
+ : "ultrawiki.ask.leg_rerank_off",
+ ),
+ degraded: false,
+ });
+ }
+ if (parts.length === 0) return null;
+ return (
+ <p
+ className="mt-1.5 flex flex-wrap gap-x-3 gap-y-0.5 text-[11px] text-muted-foreground"
+ data-testid="ultrawiki-search-legs"
+ >
+ {parts.map((part) => (
+ <span
+ key={part.key}
+ className={cn(part.degraded && "text-[#ffb84d]")}
+ data-testid={`ultrawiki-leg-${part.key}`}
+ >
+ {part.text}
+ </span>
+ ))}
+ </p>
+ );
+}
+
+const MATCHED_BY_LABEL_KEY: Record<string, string> = {
+ keyword: "ultrawiki.ask.matched_keyword",
+ vector: "ultrawiki.ask.matched_vector",
+};
+
+function ResultRow({ hit }: { hit: UltraWikiSearchHit }): JSX.Element {
+ const t = useT();
+ return (
+ <li
+ className="rounded-xl border border-border bg-card/40 p-3"
+ data-testid={`ultrawiki-hit-${hit.item_id}`}
+ >
+ <div className="flex flex-wrap items-center justify-between gap-2">
+ <span className="text-sm font-medium text-foreground">
+ {hit.title || hit.snippet.slice(0, 60)}
+ </span>
+ <span className="flex items-center gap-1.5">
+ {hit.matched_by.map((leg) => (
+ <span
+ key={leg}
+ className={cn(
+ "rounded-full border px-1.5 py-0.5 text-[10px]",
+ leg === "vector"
+ ? "border-primary/40 bg-primary/10 text-primary"
+ : "border-border text-muted-foreground",
+ )}
+ data-testid={`ultrawiki-matched-${hit.item_id}-${leg}`}
+ >
+ {t(MATCHED_BY_LABEL_KEY[leg] ?? "") || leg}
+ </span>
+ ))}
+ </span>
+ </div>
+ {hit.snippet && (
+ <p className="mt-1 text-xs leading-relaxed text-muted-foreground">
+ {hit.snippet}
+ </p>
+ )}
+ <div className="mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-0.5 text-[11px] text-muted-foreground">
+ <span className="font-mono">{hit.source_id}</span>
+ {hit.timestamp_utc && <span>{hit.timestamp_utc}</span>}
+ {/* The citation: a permalink is mandatory from item one (design doc 02). */}
+ <a
+ href={hit.permalink}
+ target="_blank"
+ rel="noreferrer"
+ className="inline-flex items-center gap-1 text-foreground underline-offset-2 hover:underline"
+ data-testid={`ultrawiki-permalink-${hit.item_id}`}
+ >
+ <ExternalLink className="h-3 w-3" aria-hidden />
+ {t("ultrawiki.ask.open_source")}
+ </a>
+ </div>
+ </li>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/components/ultrawiki/ImportProgress.tsx b/jarvis/ui/web/frontend/src/components/ultrawiki/ImportProgress.tsx
new file mode 100644
index 0000000000..ddcea8426d
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/ultrawiki/ImportProgress.tsx
@@ -0,0 +1,155 @@
+/**
+ * Honest staged import-progress strip (design doc 04 "Import progress").
+ *
+ * Renders the per-stage backlog counts (captured → keyword-searchable →
+ * embedded → distilled, plus the failed dead-letter) exactly as the store
+ * reports them — the same "honest funnel" idiom as WikiCaptureFunnelStrip —
+ * and the active/recent sync jobs with a cancel button per active job.
+ * Polling cadence is owned by the parent (UltraWikiPanel speeds the status
+ * poll up to a few seconds while a job is active).
+ */
+import { useState } from "react";
+import { Loader2, XCircle } from "lucide-react";
+
+import { cn } from "@/lib/utils";
+import { useT } from "@/i18n";
+import { useEventStore } from "@/store/events";
+import {
+ ULTRAWIKI_ACTIVE_JOB_STATUSES,
+ cancelUltraWikiJob,
+ type UltraWikiCounts,
+ type UltraWikiJob,
+} from "@/lib/ultrawikiApi";
+
+const STAGES = [
+ ["captured", "ultrawiki.progress.stage_captured"],
+ ["keyword_indexed", "ultrawiki.progress.stage_keyword_indexed"],
+ ["embedded", "ultrawiki.progress.stage_embedded"],
+ ["distilled", "ultrawiki.progress.stage_distilled"],
+ ["failed", "ultrawiki.progress.stage_failed"],
+] as const;
+
+export function ImportProgress({
+ counts,
+ pipelineRunning,
+ jobs,
+ onChanged,
+}: {
+ counts: Partial<UltraWikiCounts>;
+ pipelineRunning: boolean;
+ jobs: UltraWikiJob[];
+ onChanged: () => void;
+}): JSX.Element {
+ const t = useT();
+ const pushToast = useEventStore((s) => s.pushToast);
+ const [cancelling, setCancelling] = useState<string | null>(null);
+
+ async function handleCancel(jobId: string) {
+ setCancelling(jobId);
+ try {
+ await cancelUltraWikiJob(jobId);
+ onChanged();
+ } catch (e) {
+ pushToast(
+ "error",
+ t("ultrawiki.progress.cancel_failed").replace(
+ "{0}",
+ (e as Error).message,
+ ),
+ );
+ } finally {
+ setCancelling(null);
+ }
+ }
+
+ const activeJobs = jobs.filter((job) =>
+ ULTRAWIKI_ACTIVE_JOB_STATUSES.includes(job.status),
+ );
+
+ return (
+ <section
+ aria-label={t("ultrawiki.progress.title")}
+ className="border-b border-border bg-card/20 px-4 py-2"
+ data-testid="ultrawiki-import-progress"
+ >
+ <div className="flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px]">
+ <span className="flex items-center gap-1.5 font-medium text-foreground">
+ {pipelineRunning && (
+ <Loader2
+ className="h-3 w-3 animate-spin text-primary"
+ aria-hidden
+ data-testid="ultrawiki-pipeline-running"
+ />
+ )}
+ {t(
+ pipelineRunning
+ ? "ultrawiki.progress.pipeline_running"
+ : "ultrawiki.progress.pipeline_idle",
+ )}
+ </span>
+ <dl className="flex flex-wrap items-center gap-x-3 gap-y-1 text-muted-foreground">
+ {STAGES.map(([key, labelKey]) => {
+ const value = counts[key] ?? 0;
+ const isFailed = key === "failed";
+ return (
+ <div
+ className={cn(
+ "flex items-baseline gap-1",
+ isFailed && value > 0 && "text-destructive",
+ )}
+ data-testid={`ultrawiki-stage-${key}`}
+ key={key}
+ >
+ <dt>{t(labelKey)}</dt>
+ <dd
+ className={cn(
+ "font-medium",
+ isFailed && value > 0
+ ? "text-destructive"
+ : "text-foreground",
+ )}
+ >
+ {value}
+ </dd>
+ </div>
+ );
+ })}
+ </dl>
+ </div>
+
+ {activeJobs.length > 0 && (
+ <ul className="mt-1.5 space-y-1" data-testid="ultrawiki-active-jobs">
+ {activeJobs.map((job) => (
+ <li
+ key={job.job_id}
+ className="flex flex-wrap items-center gap-x-2 gap-y-0.5 text-[11px] text-muted-foreground"
+ data-testid={`ultrawiki-job-${job.job_id}`}
+ >
+ <Loader2 className="h-3 w-3 animate-spin" aria-hidden />
+ <span className="font-medium text-foreground">
+ {job.source_id}
+ </span>
+ <span>{job.mode}</span>
+ <span>·</span>
+ <span>{job.status}</span>
+ <span>·</span>
+ <span>
+ +{job.new} / ~{job.changed} / ={job.unchanged}
+ </span>
+ <button
+ type="button"
+ onClick={() => void handleCancel(job.job_id)}
+ disabled={cancelling === job.job_id}
+ data-testid={`ultrawiki-job-cancel-${job.job_id}`}
+ className="inline-flex items-center gap-1 rounded-md border border-border px-1.5 py-0.5 text-foreground hover:bg-muted disabled:opacity-50"
+ >
+ <XCircle className="h-3 w-3" aria-hidden />
+ {t("ultrawiki.progress.cancel")}
+ </button>
+ </li>
+ ))}
+ </ul>
+ )}
+ </section>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/components/ultrawiki/SlotsPanel.tsx b/jarvis/ui/web/frontend/src/components/ultrawiki/SlotsPanel.tsx
new file mode 100644
index 0000000000..48f8ac5105
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/ultrawiki/SlotsPanel.tsx
@@ -0,0 +1,487 @@
+/**
+ * UltraWiki capability-slot settings (design doc 04, decision D-2) — the
+ * provider-slot cards modeled on the API-Keys section: current value, honest
+ * ready/reason state, a real-call Test button per slot
+ * (`POST /api/ultrawiki/test/{slot}`), and guarded changes via
+ * `PUT /api/ultrawiki/settings`.
+ *
+ * The embedding change is the deliberate one (D-3): when vectors already
+ * exist the backend answers 409 with the vector count, and this panel shows
+ * the re-embed warning dialog before resending with `confirm_reembed=true`.
+ * The Postgres connection string is a secret (`ultrawiki_db_url`) and is
+ * never entered here — the card links to the API-Keys view instead.
+ */
+import { useState } from "react";
+import {
+ Boxes,
+ Database,
+ FlaskConical,
+ ListOrdered,
+ Loader2,
+} from "lucide-react";
+
+import { Button } from "@/components/ui/button";
+import { cn } from "@/lib/utils";
+import { useT } from "@/i18n";
+import { useEventStore } from "@/store/events";
+import {
+ SettingsBlock,
+ SettingsField,
+ settingsInputCls,
+} from "@/views/settings/SettingsBlock";
+import {
+ reembedGateOf,
+ testUltraWikiSlot,
+ updateUltraWikiSettings,
+ type UltraWikiSettingsBody,
+ type UltraWikiSlotTestResult,
+ type UltraWikiStatus,
+} from "@/lib/ultrawikiApi";
+
+type SlotName = "embedding" | "distill" | "rerank" | "storage";
+
+export function SlotsPanel({
+ status,
+ onChanged,
+}: {
+ status: UltraWikiStatus;
+ onChanged: () => void;
+}): JSX.Element {
+ const t = useT();
+ const pushToast = useEventStore((s) => s.pushToast);
+ const setActiveSection = useEventStore((s) => s.setActiveSection);
+
+ const [pending, setPending] = useState(false);
+ const [reembedGate, setReembedGate] = useState<{
+ body: UltraWikiSettingsBody;
+ vectorItems: number;
+ } | null>(null);
+
+ // Local edits fall back to the server state until the user touches them
+ // (the WikiProviderCard controlled-value idiom).
+ const [dbBackend, setDbBackend] = useState<string | null>(null);
+ const [embeddingProvider, setEmbeddingProvider] = useState<string | null>(
+ null,
+ );
+ const [embeddingModel, setEmbeddingModel] = useState<string | null>(null);
+ const [distillProvider, setDistillProvider] = useState<string | null>(null);
+ const [rerankProvider, setRerankProvider] = useState<string | null>(null);
+
+ const slots = status.slots;
+ const dbValue = dbBackend ?? status.db_backend ?? "sqlite";
+ const embeddingValue = embeddingProvider ?? slots.embedding?.provider ?? "";
+ const embeddingModelValue = embeddingModel ?? slots.embedding?.model ?? "";
+ const distillValue = distillProvider ?? slots.distill?.provider ?? "";
+ const rerankValue = rerankProvider ?? slots.rerank?.provider ?? "";
+
+ async function apply(body: UltraWikiSettingsBody) {
+ setPending(true);
+ try {
+ const result = await updateUltraWikiSettings(body);
+ pushToast(
+ "success",
+ result.reembed_started
+ ? t("ultrawiki.slots.reembed_started")
+ : t("ultrawiki.slots.applied"),
+ );
+ setDbBackend(null);
+ setEmbeddingProvider(null);
+ setEmbeddingModel(null);
+ setDistillProvider(null);
+ setRerankProvider(null);
+ onChanged();
+ } catch (e) {
+ // The guarded embedding change: 409 carries the vector count; surface
+ // the warning dialog instead of a bare error (D-3).
+ const gate = reembedGateOf(e);
+ if (gate) {
+ setReembedGate({ body, vectorItems: gate.vector_items });
+ } else {
+ pushToast(
+ "error",
+ t("ultrawiki.slots.apply_failed").replace(
+ "{0}",
+ (e as Error).message,
+ ),
+ );
+ }
+ } finally {
+ setPending(false);
+ }
+ }
+
+ return (
+ <div className="space-y-4 p-4" data-testid="ultrawiki-slots-panel">
+ <h3 className="text-sm font-medium text-foreground">
+ {t("ultrawiki.slots.title")}
+ </h3>
+
+ {/* Storage */}
+ <SettingsBlock
+ icon={Database}
+ title={t("ultrawiki.slots.storage_title")}
+ description={t("ultrawiki.slots.storage_desc")}
+ headerRight={<SlotTestControl slot="storage" />}
+ >
+ <div className="space-y-3">
+ <SettingsField label={t("ultrawiki.slots.storage_title")}>
+ <select
+ value={dbValue}
+ onChange={(e) => setDbBackend(e.target.value)}
+ className={settingsInputCls}
+ data-testid="ultrawiki-storage-select"
+ >
+ <option value="sqlite">
+ {t("ultrawiki.slots.storage_sqlite")}
+ </option>
+ <option value="postgres">
+ {t("ultrawiki.slots.storage_postgres")}
+ </option>
+ </select>
+ </SettingsField>
+ {status.backend_in_use && (
+ <p className="text-[11px] text-muted-foreground">
+ {t("ultrawiki.slots.in_use").replace(
+ "{0}",
+ status.backend_in_use,
+ )}
+ </p>
+ )}
+ {dbValue === "postgres" && (
+ <div className="space-y-2 rounded-lg border border-border/60 bg-muted/20 p-3 text-xs text-muted-foreground">
+ {/* Connection strings are secrets (AP-2/AP-12): saved as
+ 'ultrawiki_db_url' via the secrets surface, never typed here. */}
+ <p>{t("ultrawiki.slots.storage_postgres_hint")}</p>
+ <Button
+ variant="outline"
+ size="sm"
+ onClick={() => setActiveSection("apikeys")}
+ data-testid="ultrawiki-open-apikeys"
+ >
+ {t("ultrawiki.slots.open_api_keys")}
+ </Button>
+ </div>
+ )}
+ <ApplyButton
+ pending={pending}
+ onClick={() => void apply({ db_backend: dbValue })}
+ testId="ultrawiki-storage-apply"
+ />
+ </div>
+ </SettingsBlock>
+
+ {/* Embedding */}
+ <SettingsBlock
+ icon={Boxes}
+ title={t("ultrawiki.slots.embedding_title")}
+ description={t("ultrawiki.slots.embedding_desc")}
+ headerRight={<SlotTestControl slot="embedding" />}
+ >
+ <div className="space-y-3">
+ <SlotHealthLine
+ ready={slots.embedding?.ready}
+ reason={slots.embedding?.reason}
+ current={
+ slots.embedding?.provider
+ ? `${slots.embedding.provider}${slots.embedding.model ? ` · ${slots.embedding.model}` : ""}`
+ : ""
+ }
+ />
+ <div className="grid gap-4 sm:grid-cols-2">
+ <SettingsField label={t("ultrawiki.slots.provider_label")}>
+ <select
+ value={embeddingValue}
+ onChange={(e) => {
+ setEmbeddingProvider(e.target.value);
+ setEmbeddingModel("");
+ }}
+ className={settingsInputCls}
+ data-testid="ultrawiki-embedding-select"
+ >
+ {(slots.embedding?.available ?? []).map((option) => (
+ <option key={option.name} value={option.name}>
+ {option.name}
+ {!option.ready
+ ? ` (${t("ultrawiki.slots.not_ready_suffix")})`
+ : ""}
+ </option>
+ ))}
+ </select>
+ </SettingsField>
+ <SettingsField label={t("ultrawiki.slots.model_label")}>
+ <input
+ type="text"
+ value={embeddingModelValue}
+ onChange={(e) => setEmbeddingModel(e.target.value)}
+ placeholder={t(
+ "ultrawiki.slots.model_default_placeholder",
+ ).replace(
+ "{0}",
+ (slots.embedding?.available ?? []).find(
+ (o) => o.name === embeddingValue,
+ )?.default_model ?? "",
+ )}
+ className={settingsInputCls}
+ data-testid="ultrawiki-embedding-model-input"
+ />
+ </SettingsField>
+ </div>
+ <ApplyButton
+ pending={pending}
+ onClick={() =>
+ void apply({
+ embedding_provider: embeddingValue,
+ embedding_model: embeddingModelValue,
+ })
+ }
+ testId="ultrawiki-embedding-apply"
+ />
+ </div>
+ </SettingsBlock>
+
+ {/* Distillation */}
+ <SettingsBlock
+ icon={FlaskConical}
+ title={t("ultrawiki.slots.distill_title")}
+ description={t("ultrawiki.slots.distill_desc")}
+ headerRight={<SlotTestControl slot="distill" />}
+ >
+ <div className="space-y-3">
+ <SlotHealthLine
+ ready={slots.distill?.ready}
+ reason={slots.distill?.reason}
+ current={slots.distill?.provider ?? ""}
+ />
+ <SettingsField label={t("ultrawiki.slots.provider_label")}>
+ <select
+ value={distillValue}
+ onChange={(e) => setDistillProvider(e.target.value)}
+ className={settingsInputCls}
+ data-testid="ultrawiki-distill-select"
+ >
+ <option value="">{t("ultrawiki.slots.distill_auto")}</option>
+ {(slots.distill?.chain ?? [])
+ .filter((name) => name !== "")
+ .map((name) => (
+ <option key={name} value={name}>
+ {name}
+ </option>
+ ))}
+ {!(slots.distill?.chain ?? []).includes("ollama") && (
+ <option value="ollama">ollama</option>
+ )}
+ </select>
+ </SettingsField>
+ <p className="text-[11px] text-muted-foreground">
+ {(slots.distill?.chain ?? []).length > 0
+ ? t("ultrawiki.slots.distill_chain").replace(
+ "{0}",
+ (slots.distill?.chain ?? []).join(", "),
+ )
+ : t("ultrawiki.slots.distill_chain_empty")}
+ </p>
+ <ApplyButton
+ pending={pending}
+ onClick={() => void apply({ distill_provider: distillValue })}
+ testId="ultrawiki-distill-apply"
+ />
+ </div>
+ </SettingsBlock>
+
+ {/* Rerank */}
+ <SettingsBlock
+ icon={ListOrdered}
+ title={t("ultrawiki.slots.rerank_title")}
+ description={t("ultrawiki.slots.rerank_desc")}
+ headerRight={<SlotTestControl slot="rerank" />}
+ >
+ <div className="space-y-3">
+ <SlotHealthLine
+ ready={slots.rerank?.ready}
+ reason={slots.rerank?.reason}
+ current={slots.rerank?.provider ?? ""}
+ />
+ <SettingsField label={t("ultrawiki.slots.provider_label")}>
+ <select
+ value={rerankValue}
+ onChange={(e) => setRerankProvider(e.target.value)}
+ className={settingsInputCls}
+ data-testid="ultrawiki-rerank-select"
+ >
+ <option value="">{t("ultrawiki.slots.rerank_off")}</option>
+ {(slots.rerank?.available ?? []).map((option) => (
+ <option key={option.name} value={option.name}>
+ {option.name}
+ {!option.ready
+ ? ` (${t("ultrawiki.slots.not_ready_suffix")})`
+ : ""}
+ </option>
+ ))}
+ </select>
+ </SettingsField>
+ <ApplyButton
+ pending={pending}
+ onClick={() => void apply({ rerank_provider: rerankValue })}
+ testId="ultrawiki-rerank-apply"
+ />
+ </div>
+ </SettingsBlock>
+
+ {reembedGate && (
+ <div
+ className="fixed inset-0 z-[70] flex items-center justify-center bg-background/80 backdrop-blur-sm"
+ role="dialog"
+ aria-modal="true"
+ aria-labelledby="ultrawiki-reembed-title"
+ data-testid="ultrawiki-reembed-dialog"
+ onClick={(e) => {
+ if (e.target === e.currentTarget) setReembedGate(null);
+ }}
+ >
+ <div
+ className="w-full max-w-md rounded-2xl border border-border bg-card p-6 shadow-2xl"
+ onClick={(e) => e.stopPropagation()}
+ >
+ <h2
+ id="ultrawiki-reembed-title"
+ className="text-base font-semibold text-foreground"
+ >
+ {t("ultrawiki.slots.reembed_title")}
+ </h2>
+ <p className="mt-2 text-sm leading-relaxed text-muted-foreground">
+ {t("ultrawiki.slots.reembed_body").replace(
+ "{0}",
+ String(reembedGate.vectorItems),
+ )}
+ </p>
+ <div className="mt-4 flex justify-end gap-2">
+ <Button
+ variant="outline"
+ size="sm"
+ onClick={() => setReembedGate(null)}
+ >
+ {t("ultrawiki.mode.cancel")}
+ </Button>
+ <Button
+ size="sm"
+ onClick={() => {
+ const body = {
+ ...reembedGate.body,
+ confirm_reembed: true,
+ };
+ setReembedGate(null);
+ void apply(body);
+ }}
+ data-testid="ultrawiki-reembed-confirm"
+ >
+ {t("ultrawiki.slots.reembed_confirm").replace(
+ "{0}",
+ String(reembedGate.vectorItems),
+ )}
+ </Button>
+ </div>
+ </div>
+ </div>
+ )}
+ </div>
+ );
+}
+
+function ApplyButton({
+ pending,
+ onClick,
+ testId,
+}: {
+ pending: boolean;
+ onClick: () => void;
+ testId: string;
+}): JSX.Element {
+ const t = useT();
+ return (
+ <Button size="sm" onClick={onClick} disabled={pending} data-testid={testId}>
+ {pending && (
+ <Loader2 className="mr-1 h-3.5 w-3.5 animate-spin" aria-hidden />
+ )}
+ {t(pending ? "ultrawiki.slots.applying" : "ultrawiki.slots.apply")}
+ </Button>
+ );
+}
+
+/** Current value + honest ready/reason line (calm when ready, amber when not). */
+function SlotHealthLine({
+ ready,
+ reason,
+ current,
+}: {
+ ready: boolean | undefined;
+ reason: string | undefined;
+ current: string;
+}): JSX.Element | null {
+ const t = useT();
+ if (!current && !reason) return null;
+ return (
+ <div className="space-y-0.5 text-[11px]">
+ {current && (
+ <p className="text-muted-foreground">
+ {t("ultrawiki.slots.current").replace("{0}", current)}
+ </p>
+ )}
+ {ready === false && reason && (
+ <p className="text-[#ffb84d]">{reason}</p>
+ )}
+ </div>
+ );
+}
+
+/** Per-slot real-call Test button + result chip (ApiKeysView test idiom). */
+function SlotTestControl({ slot }: { slot: SlotName }): JSX.Element {
+ const t = useT();
+ const [testing, setTesting] = useState(false);
+ const [result, setResult] = useState<UltraWikiSlotTestResult | null>(null);
+
+ async function handleTest() {
+ setTesting(true);
+ setResult(null);
+ try {
+ setResult(await testUltraWikiSlot(slot));
+ } catch (e) {
+ setResult({ ok: false, detail: (e as Error).message, latency_ms: 0 });
+ } finally {
+ setTesting(false);
+ }
+ }
+
+ return (
+ <div className="flex items-center gap-2">
+ {result && (
+ <span
+ className={cn(
+ "max-w-[16rem] truncate rounded-full border px-2 py-0.5 text-[10px]",
+ result.ok
+ ? "border-[#5bd4a4]/40 bg-[#5bd4a4]/10 text-[#5bd4a4]"
+ : "border-destructive/40 bg-destructive/10 text-destructive",
+ )}
+ title={result.detail}
+ data-testid={`ultrawiki-test-result-${slot}`}
+ data-ok={result.ok ? "true" : "false"}
+ >
+ {t(result.ok ? "ultrawiki.slots.test_ok" : "ultrawiki.slots.test_failed")}
+ {" · "}
+ {result.detail}
+ </span>
+ )}
+ <Button
+ variant="outline"
+ size="sm"
+ onClick={() => void handleTest()}
+ disabled={testing}
+ data-testid={`ultrawiki-test-${slot}`}
+ >
+ {testing && (
+ <Loader2 className="mr-1 h-3.5 w-3.5 animate-spin" aria-hidden />
+ )}
+ {t(testing ? "ultrawiki.slots.testing" : "ultrawiki.slots.test")}
+ </Button>
+ </div>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/components/ultrawiki/SourcesPanel.test.tsx b/jarvis/ui/web/frontend/src/components/ultrawiki/SourcesPanel.test.tsx
new file mode 100644
index 0000000000..014681f46e
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/ultrawiki/SourcesPanel.test.tsx
@@ -0,0 +1,163 @@
+/**
+ * SourcesPanel tests — the consent gate.
+ *
+ * Pins that Approve is an explicit POST to the approve route and that a
+ * pending source exposes NO sync control at all (the backend would refuse
+ * the sync; the UI must not dangle a dead button).
+ */
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+
+import { SourcesPanel } from "@/components/ultrawiki/SourcesPanel";
+import { useEventStore } from "@/store/events";
+import type { UltraWikiSource } from "@/lib/ultrawikiApi";
+
+function renderWithClient(node: React.ReactNode) {
+ const client = new QueryClient({
+ defaultOptions: { queries: { retry: false, gcTime: 0, staleTime: 0 } },
+ });
+ return render(
+ <QueryClientProvider client={client}>{node}</QueryClientProvider>,
+ );
+}
+
+function installFetchMock(
+ routes: Record<string, (init?: RequestInit) => unknown>,
+) {
+ const fetchMock = vi.fn(
+ async (input: RequestInfo | URL, init?: RequestInit) => {
+ const url = String(input);
+ const prefixes = Object.keys(routes).sort((a, b) => b.length - a.length);
+ for (const prefix of prefixes) {
+ if (url.startsWith(prefix)) {
+ return {
+ ok: true,
+ status: 200,
+ statusText: "OK",
+ json: async () => routes[prefix](init),
+ } as Response;
+ }
+ }
+ throw new Error(`unexpected fetch ${url}`);
+ },
+ );
+ (globalThis as unknown as { fetch: typeof fetch }).fetch =
+ fetchMock as unknown as typeof fetch;
+ return fetchMock;
+}
+
+function source(overrides: Partial<UltraWikiSource>): UltraWikiSource {
+ return {
+ id: "src-x",
+ connector: "local-folder",
+ label: "Some folder",
+ consent: "pending",
+ enabled: true,
+ areas: [],
+ counts: {
+ captured: 1,
+ keyword_indexed: 2,
+ embedded: 3,
+ distilled: 4,
+ failed: 0,
+ total: 10,
+ },
+ sync_state: null,
+ last_sync_at: null,
+ last_error: null,
+ ...overrides,
+ };
+}
+
+const PENDING = source({ id: "src-pending", label: "Pending folder" });
+const APPROVED = source({
+ id: "src-approved",
+ label: "Approved folder",
+ consent: "approved",
+ last_sync_at: "2026-07-20T10:00:00Z",
+});
+
+beforeEach(() => {
+ // Brand discipline: pin an arbitrary assistant name, never the host config.
+ useEventStore.getState().setAssistantName("Nova");
+});
+
+afterEach(() => {
+ cleanup();
+ vi.restoreAllMocks();
+});
+
+describe("SourcesPanel — consent gate", () => {
+ it("fires the approve POST for a pending source and reports the change", async () => {
+ const fetchMock = installFetchMock({
+ "/api/ultrawiki/sources/src-pending/approve": () => ({
+ ...PENDING,
+ consent: "approved",
+ }),
+ });
+ const onChanged = vi.fn();
+ renderWithClient(
+ <SourcesPanel sources={[PENDING, APPROVED]} onChanged={onChanged} />,
+ );
+
+ fireEvent.click(screen.getByTestId("uw-source-approve-src-pending"));
+
+ await waitFor(() => {
+ expect(fetchMock).toHaveBeenCalledWith(
+ "/api/ultrawiki/sources/src-pending/approve",
+ expect.objectContaining({ method: "POST" }),
+ );
+ });
+ await waitFor(() => {
+ expect(onChanged).toHaveBeenCalledTimes(1);
+ });
+ });
+
+ it("shows NO sync control on a pending source, but does on an approved one", () => {
+ installFetchMock({});
+ renderWithClient(
+ <SourcesPanel sources={[PENDING, APPROVED]} onChanged={vi.fn()} />,
+ );
+
+ // Pending: consent badge, approve button + scope description, no sync.
+ expect(
+ screen
+ .getByTestId("ultrawiki-consent-src-pending")
+ .getAttribute("data-consent"),
+ ).toBe("pending");
+ expect(screen.getByTestId("uw-source-approve-src-pending")).toBeDefined();
+ expect(screen.queryByTestId("uw-source-sync-src-pending")).toBeNull();
+
+ // Approved: sync + revoke, no approve.
+ expect(screen.getByTestId("uw-source-sync-src-approved")).toBeDefined();
+ expect(screen.getByTestId("uw-source-revoke-src-approved")).toBeDefined();
+ expect(screen.queryByTestId("uw-source-approve-src-approved")).toBeNull();
+ });
+
+ it("starts a sync for an approved source via the sync route", async () => {
+ const fetchMock = installFetchMock({
+ "/api/ultrawiki/sources/src-approved/sync": () => ({
+ job_id: "job-1",
+ status: "queued",
+ source_id: "src-approved",
+ }),
+ });
+ const onChanged = vi.fn();
+ renderWithClient(
+ <SourcesPanel sources={[APPROVED]} onChanged={onChanged} />,
+ );
+
+ fireEvent.click(screen.getByTestId("uw-source-sync-src-approved"));
+
+ await waitFor(() => {
+ expect(fetchMock).toHaveBeenCalledWith(
+ "/api/ultrawiki/sources/src-approved/sync",
+ expect.objectContaining({ method: "POST" }),
+ );
+ });
+ await waitFor(() => {
+ expect(onChanged).toHaveBeenCalledTimes(1);
+ });
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/components/ultrawiki/SourcesPanel.tsx b/jarvis/ui/web/frontend/src/components/ultrawiki/SourcesPanel.tsx
new file mode 100644
index 0000000000..498f5ad4ad
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/ultrawiki/SourcesPanel.tsx
@@ -0,0 +1,593 @@
+/**
+ * Connected-sources panel (design doc 04 "Sources view").
+ *
+ * Consent is THE gate: every source starts as `pending`, the Approve button
+ * is an explicit user action with a short scope description, and a source
+ * without approved consent shows NO sync control at all — the backend would
+ * refuse the sync anyway (`service.start_sync`), the UI just does not dangle
+ * a dead button. Per source: consent badge, per-stage backlog counts, last
+ * sync / last error, Approve / Revoke / Sync now.
+ *
+ * "Add source": connector picker over the five built-ins, a path field for
+ * the folder-shaped connectors, area assignment, and — for the
+ * plugin-bridge — the connected-integration candidates from
+ * `GET /api/ultrawiki/bridge/candidates`, with a "pull adapter pending"
+ * candidate marked honestly (registering it works, a sync finds nothing yet).
+ */
+import { useState } from "react";
+import {
+ Check,
+ FolderOpen,
+ Loader2,
+ Plus,
+ RefreshCw,
+ ShieldCheck,
+ ShieldOff,
+} from "lucide-react";
+import { useQuery } from "@tanstack/react-query";
+
+import { Button } from "@/components/ui/button";
+import { cn } from "@/lib/utils";
+import { useT } from "@/i18n";
+import { useEventStore } from "@/store/events";
+import {
+ ULTRAWIKI_CONNECTOR_IDS,
+ approveUltraWikiSource,
+ createUltraWikiSource,
+ fetchUltraWikiAreas,
+ fetchUltraWikiBridgeCandidates,
+ revokeUltraWikiSource,
+ startUltraWikiSync,
+ type UltraWikiConnectorId,
+ type UltraWikiSource,
+} from "@/lib/ultrawikiApi";
+
+const CONNECTOR_LABEL_KEY: Record<UltraWikiConnectorId, string> = {
+ "obsidian-vault": "ultrawiki.sources.connector_obsidian",
+ "local-folder": "ultrawiki.sources.connector_local_folder",
+ "jarvis-conversations": "ultrawiki.sources.connector_conversations",
+ "normal-wiki": "ultrawiki.sources.connector_normal_wiki",
+ "plugin-bridge": "ultrawiki.sources.connector_plugin_bridge",
+};
+
+/** Connectors that read a user-chosen folder (config key `root`). */
+const PATH_CONNECTORS: readonly string[] = ["obsidian-vault", "local-folder"];
+
+const CONSENT_BADGE: Record<
+ string,
+ { labelKey: string; className: string }
+> = {
+ pending: {
+ labelKey: "ultrawiki.sources.consent_pending",
+ className: "border-[#ffb84d]/40 bg-[#ffb84d]/10 text-[#ffb84d]",
+ },
+ approved: {
+ labelKey: "ultrawiki.sources.consent_approved",
+ className: "border-[#5bd4a4]/40 bg-[#5bd4a4]/10 text-[#5bd4a4]",
+ },
+ revoked: {
+ labelKey: "ultrawiki.sources.consent_revoked",
+ className: "border-destructive/40 bg-destructive/10 text-destructive",
+ },
+};
+
+const STAGE_KEYS = [
+ ["captured", "ultrawiki.progress.stage_captured"],
+ ["keyword_indexed", "ultrawiki.progress.stage_keyword_indexed"],
+ ["embedded", "ultrawiki.progress.stage_embedded"],
+ ["distilled", "ultrawiki.progress.stage_distilled"],
+ ["failed", "ultrawiki.progress.stage_failed"],
+] as const;
+
+export function SourcesPanel({
+ sources,
+ onChanged,
+}: {
+ sources: UltraWikiSource[];
+ onChanged: () => void;
+}): JSX.Element {
+ const t = useT();
+ const pushToast = useEventStore((s) => s.pushToast);
+ const [busySource, setBusySource] = useState<string | null>(null);
+ const [addOpen, setAddOpen] = useState(false);
+
+ async function run(sourceId: string, action: () => Promise<unknown>) {
+ setBusySource(sourceId);
+ try {
+ await action();
+ onChanged();
+ } catch (e) {
+ pushToast(
+ "error",
+ t("ultrawiki.sources.action_failed").replace(
+ "{0}",
+ (e as Error).message,
+ ),
+ );
+ } finally {
+ setBusySource(null);
+ }
+ }
+
+ return (
+ <div className="space-y-3 p-4" data-testid="ultrawiki-sources-panel">
+ <div className="flex items-center justify-between gap-3">
+ <h3 className="text-sm font-medium text-foreground">
+ {t("ultrawiki.sources.title")}
+ </h3>
+ <Button
+ variant="outline"
+ size="sm"
+ onClick={() => setAddOpen((open) => !open)}
+ data-testid="ultrawiki-add-source-toggle"
+ >
+ <Plus className="mr-1 h-3.5 w-3.5" aria-hidden />
+ {t("ultrawiki.sources.add_source")}
+ </Button>
+ </div>
+
+ {addOpen && (
+ <AddSourceForm
+ onClose={() => setAddOpen(false)}
+ onCreated={() => {
+ setAddOpen(false);
+ onChanged();
+ }}
+ />
+ )}
+
+ {sources.length === 0 ? (
+ <p
+ className="rounded-lg border border-dashed border-border/70 bg-card/30 p-4 text-xs text-muted-foreground"
+ data-testid="ultrawiki-sources-empty"
+ >
+ {t("ultrawiki.sources.empty")}
+ </p>
+ ) : (
+ <ul className="space-y-2">
+ {sources.map((source) => (
+ <SourceCard
+ key={source.id}
+ source={source}
+ busy={busySource === source.id}
+ onApprove={() =>
+ void run(source.id, () => approveUltraWikiSource(source.id))
+ }
+ onRevoke={() =>
+ void run(source.id, () => revokeUltraWikiSource(source.id))
+ }
+ onSync={() =>
+ void run(source.id, async () => {
+ await startUltraWikiSync(source.id);
+ pushToast("success", t("ultrawiki.sources.sync_started"));
+ })
+ }
+ />
+ ))}
+ </ul>
+ )}
+ </div>
+ );
+}
+
+function SourceCard({
+ source,
+ busy,
+ onApprove,
+ onRevoke,
+ onSync,
+}: {
+ source: UltraWikiSource;
+ busy: boolean;
+ onApprove: () => void;
+ onRevoke: () => void;
+ onSync: () => void;
+}): JSX.Element {
+ const t = useT();
+ const consent = String(source.consent);
+ const badge = CONSENT_BADGE[consent] ?? CONSENT_BADGE.pending;
+ const approved = consent === "approved";
+
+ return (
+ <li
+ className="card-outline rounded-xl border border-border bg-card/40 p-3"
+ data-testid={`ultrawiki-source-${source.id}`}
+ >
+ <div className="flex flex-wrap items-center justify-between gap-2">
+ <div className="min-w-0">
+ <span className="text-sm font-medium text-foreground">
+ {source.label}
+ </span>
+ <span className="ml-2 font-mono text-[10px] text-muted-foreground">
+ {source.connector}
+ </span>
+ </div>
+ <span
+ className={cn(
+ "rounded-full border px-2 py-0.5 text-[10px]",
+ badge.className,
+ )}
+ data-testid={`ultrawiki-consent-${source.id}`}
+ data-consent={consent}
+ >
+ {t(badge.labelKey)}
+ </span>
+ </div>
+
+ {source.counts && (
+ <dl className="mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-muted-foreground">
+ {STAGE_KEYS.map(([key, labelKey]) => {
+ const value = source.counts?.[key] ?? 0;
+ return (
+ <div className="flex items-baseline gap-1" key={key}>
+ <dt>{t(labelKey)}</dt>
+ <dd
+ className={cn(
+ "font-medium",
+ key === "failed" && value > 0
+ ? "text-destructive"
+ : "text-foreground",
+ )}
+ >
+ {value}
+ </dd>
+ </div>
+ );
+ })}
+ </dl>
+ )}
+
+ <div className="mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-0.5 text-[11px] text-muted-foreground">
+ <span>
+ {source.last_sync_at
+ ? t("ultrawiki.sources.last_sync").replace(
+ "{0}",
+ source.last_sync_at,
+ )
+ : t("ultrawiki.sources.never_synced")}
+ </span>
+ {source.areas.length > 0 && (
+ <span>
+ {t("ultrawiki.sources.areas").replace(
+ "{0}",
+ source.areas.join(", "),
+ )}
+ </span>
+ )}
+ {source.last_error && (
+ <span
+ className="text-destructive"
+ data-testid={`ultrawiki-source-error-${source.id}`}
+ >
+ {t("ultrawiki.sources.last_error").replace(
+ "{0}",
+ source.last_error,
+ )}
+ </span>
+ )}
+ </div>
+
+ <div className="mt-2 flex flex-wrap items-center gap-2">
+ {!approved && (
+ <Button
+ size="sm"
+ onClick={onApprove}
+ disabled={busy}
+ data-testid={`uw-source-approve-${source.id}`}
+ >
+ {busy ? (
+ <Loader2 className="mr-1 h-3.5 w-3.5 animate-spin" aria-hidden />
+ ) : (
+ <ShieldCheck className="mr-1 h-3.5 w-3.5" aria-hidden />
+ )}
+ {t("ultrawiki.sources.approve")}
+ </Button>
+ )}
+ {approved && (
+ <>
+ {/* Consent gate: the sync control exists ONLY on approved sources. */}
+ <Button
+ variant="outline"
+ size="sm"
+ onClick={onSync}
+ disabled={busy}
+ data-testid={`uw-source-sync-${source.id}`}
+ >
+ <RefreshCw
+ className={cn("mr-1 h-3.5 w-3.5", busy && "animate-spin")}
+ aria-hidden
+ />
+ {t("ultrawiki.sources.sync_now")}
+ </Button>
+ <Button
+ variant="outline"
+ size="sm"
+ onClick={onRevoke}
+ disabled={busy}
+ data-testid={`uw-source-revoke-${source.id}`}
+ >
+ <ShieldOff className="mr-1 h-3.5 w-3.5" aria-hidden />
+ {t("ultrawiki.sources.revoke")}
+ </Button>
+ </>
+ )}
+ </div>
+
+ {!approved && (
+ <p className="mt-1.5 text-[11px] leading-relaxed text-muted-foreground">
+ {t("ultrawiki.sources.approve_scope")}
+ </p>
+ )}
+ </li>
+ );
+}
+
+function AddSourceForm({
+ onClose,
+ onCreated,
+}: {
+ onClose: () => void;
+ onCreated: () => void;
+}): JSX.Element {
+ const t = useT();
+ const [connector, setConnector] =
+ useState<UltraWikiConnectorId>("obsidian-vault");
+ const [label, setLabel] = useState("");
+ const [rootPath, setRootPath] = useState("");
+ const [integrationId, setIntegrationId] = useState("");
+ const [selectedAreas, setSelectedAreas] = useState<string[]>([]);
+ const [submitting, setSubmitting] = useState(false);
+ const [error, setError] = useState("");
+
+ const areasQuery = useQuery({
+ queryKey: ["ultrawiki", "areas"],
+ queryFn: fetchUltraWikiAreas,
+ staleTime: 5_000,
+ });
+ const bridgeQuery = useQuery({
+ queryKey: ["ultrawiki", "bridge-candidates"],
+ queryFn: fetchUltraWikiBridgeCandidates,
+ staleTime: 5_000,
+ enabled: connector === "plugin-bridge",
+ });
+
+ const needsPath = PATH_CONNECTORS.includes(connector);
+
+ function toggleArea(id: string) {
+ setSelectedAreas((current) =>
+ current.includes(id)
+ ? current.filter((a) => a !== id)
+ : [...current, id],
+ );
+ }
+
+ async function handleSubmit(e: React.FormEvent) {
+ e.preventDefault();
+ setSubmitting(true);
+ setError("");
+ const config: Record<string, unknown> = {};
+ if (needsPath && rootPath.trim()) config.root = rootPath.trim();
+ if (connector === "plugin-bridge" && integrationId) {
+ config.integration_id = integrationId;
+ }
+ try {
+ await createUltraWikiSource({
+ connector,
+ label: label.trim() || t(CONNECTOR_LABEL_KEY[connector]),
+ config,
+ areas: selectedAreas,
+ });
+ onCreated();
+ } catch (err) {
+ setError(
+ t("ultrawiki.sources.create_failed").replace(
+ "{0}",
+ (err as Error).message,
+ ),
+ );
+ } finally {
+ setSubmitting(false);
+ }
+ }
+
+ const inputCls =
+ "w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground/70 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary/40";
+
+ return (
+ <form
+ onSubmit={(e) => void handleSubmit(e)}
+ className="space-y-3 rounded-xl border border-border bg-card/40 p-3"
+ data-testid="ultrawiki-add-source-form"
+ >
+ <h4 className="text-xs font-medium text-foreground">
+ {t("ultrawiki.sources.add_title")}
+ </h4>
+
+ <label className="block">
+ <span className="mb-1.5 block text-[10px] uppercase tracking-wider text-muted-foreground">
+ {t("ultrawiki.sources.connector_label")}
+ </span>
+ <select
+ value={connector}
+ onChange={(e) =>
+ setConnector(e.target.value as UltraWikiConnectorId)
+ }
+ className={inputCls}
+ data-testid="ultrawiki-connector-select"
+ >
+ {ULTRAWIKI_CONNECTOR_IDS.map((id) => (
+ <option key={id} value={id}>
+ {t(CONNECTOR_LABEL_KEY[id])}
+ </option>
+ ))}
+ </select>
+ </label>
+
+ <label className="block">
+ <span className="mb-1.5 block text-[10px] uppercase tracking-wider text-muted-foreground">
+ {t("ultrawiki.sources.label_label")}
+ </span>
+ <input
+ type="text"
+ value={label}
+ onChange={(e) => setLabel(e.target.value)}
+ placeholder={t(CONNECTOR_LABEL_KEY[connector])}
+ className={inputCls}
+ />
+ </label>
+
+ {needsPath && (
+ <label className="block">
+ <span className="mb-1.5 flex items-center gap-1 text-[10px] uppercase tracking-wider text-muted-foreground">
+ <FolderOpen className="h-3 w-3" aria-hidden />
+ {t("ultrawiki.sources.path_label")}
+ </span>
+ <input
+ type="text"
+ value={rootPath}
+ onChange={(e) => setRootPath(e.target.value)}
+ className={inputCls}
+ data-testid="ultrawiki-path-input"
+ />
+ <span className="mt-1 block text-[11px] text-muted-foreground">
+ {t("ultrawiki.sources.path_hint")}
+ </span>
+ </label>
+ )}
+
+ {connector === "plugin-bridge" && (
+ <div>
+ <span className="mb-1.5 block text-[10px] uppercase tracking-wider text-muted-foreground">
+ {t("ultrawiki.sources.bridge_label")}
+ </span>
+ {bridgeQuery.isLoading ? (
+ <div className="flex items-center gap-2 text-xs text-muted-foreground">
+ <Loader2 className="h-3.5 w-3.5 animate-spin" aria-hidden />
+ {t("ultrawiki.panel.loading")}
+ </div>
+ ) : bridgeQuery.isError ? (
+ <p className="text-xs text-destructive">
+ {t("ultrawiki.sources.bridge_load_failed")}
+ </p>
+ ) : (bridgeQuery.data?.candidates ?? []).length === 0 ? (
+ <p className="text-xs text-muted-foreground">
+ {t("ultrawiki.sources.bridge_empty")}
+ </p>
+ ) : (
+ <ul className="space-y-1.5">
+ {(bridgeQuery.data?.candidates ?? []).map((candidate) => {
+ const selected = integrationId === candidate.id;
+ // The backend states adapter readiness inside `detail`; mark
+ // "pull adapter pending" honestly instead of hiding it.
+ const adapterPending = candidate.detail.includes(
+ "pull adapter pending",
+ );
+ return (
+ <li key={candidate.id}>
+ <button
+ type="button"
+ onClick={() => setIntegrationId(candidate.id)}
+ aria-pressed={selected}
+ data-testid={`ultrawiki-bridge-${candidate.id}`}
+ className={cn(
+ "w-full rounded-lg border p-2 text-left text-xs transition-colors",
+ selected
+ ? "border-primary/60 bg-primary/5 ring-1 ring-primary/40"
+ : "border-border hover:bg-secondary/30",
+ )}
+ >
+ <span className="flex items-center gap-2">
+ {selected && (
+ <Check className="h-3 w-3 text-primary" aria-hidden />
+ )}
+ <span className="font-medium text-foreground">
+ {candidate.label}
+ </span>
+ <span className="font-mono text-[10px] text-muted-foreground">
+ {candidate.kind}
+ </span>
+ {adapterPending && (
+ <span className="rounded-full border border-[#ffb84d]/40 bg-[#ffb84d]/10 px-1.5 py-0.5 text-[10px] text-[#ffb84d]">
+ {t("ultrawiki.sources.adapter_pending")}
+ </span>
+ )}
+ </span>
+ <span className="mt-0.5 block text-muted-foreground">
+ {candidate.detail}
+ </span>
+ {adapterPending && selected && (
+ <span className="mt-1 block text-[#ffb84d]">
+ {t("ultrawiki.sources.adapter_pending_hint")}
+ </span>
+ )}
+ </button>
+ </li>
+ );
+ })}
+ </ul>
+ )}
+ </div>
+ )}
+
+ <div>
+ <span className="mb-1.5 block text-[10px] uppercase tracking-wider text-muted-foreground">
+ {t("ultrawiki.sources.areas_label")}
+ </span>
+ {(areasQuery.data?.areas ?? []).length === 0 ? (
+ <p className="text-[11px] text-muted-foreground">
+ {t("ultrawiki.sources.no_areas")}
+ </p>
+ ) : (
+ <div className="flex flex-wrap gap-2">
+ {(areasQuery.data?.areas ?? []).map((area) => (
+ <label
+ key={area.id}
+ className="flex cursor-pointer items-center gap-1.5 rounded-full border border-border px-2.5 py-1 text-[11px] text-muted-foreground has-[:checked]:border-primary/50 has-[:checked]:text-foreground"
+ >
+ <input
+ type="checkbox"
+ className="h-3 w-3 accent-[#FFD60A]"
+ checked={selectedAreas.includes(area.id)}
+ onChange={() => toggleArea(area.id)}
+ />
+ {area.name}
+ </label>
+ ))}
+ </div>
+ )}
+ </div>
+
+ {error && (
+ <p className="text-xs text-destructive" role="alert">
+ {error}
+ </p>
+ )}
+
+ <div className="flex items-center justify-between gap-2">
+ <p className="text-[11px] text-muted-foreground">
+ {t("ultrawiki.sources.create_hint")}
+ </p>
+ <div className="flex shrink-0 gap-2">
+ <Button variant="outline" size="sm" type="button" onClick={onClose}>
+ {t("ultrawiki.sources.cancel")}
+ </Button>
+ <Button
+ size="sm"
+ type="submit"
+ disabled={
+ submitting ||
+ (connector === "plugin-bridge" && !integrationId) ||
+ (needsPath && !rootPath.trim())
+ }
+ data-testid="ultrawiki-create-source"
+ >
+ {submitting && (
+ <Loader2 className="mr-1 h-3.5 w-3.5 animate-spin" aria-hidden />
+ )}
+ {t("ultrawiki.sources.create")}
+ </Button>
+ </div>
+ </div>
+ </form>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/components/ultrawiki/UltraModeSwitch.tsx b/jarvis/ui/web/frontend/src/components/ultrawiki/UltraModeSwitch.tsx
new file mode 100644
index 0000000000..c074efad5c
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/ultrawiki/UltraModeSwitch.tsx
@@ -0,0 +1,234 @@
+/**
+ * Compact Normal | Ultra segmented toggle at the top of the Wiki section
+ * (decision D-5: either-or, exactly one mode owns capture and answering).
+ *
+ * Mode source of truth: `GET /api/ultrawiki/status` → `enabled` (owned by the
+ * parent's query; this component only renders the snapshot it is given and
+ * reports back via `onModeChanged` so the parent refetches).
+ *
+ * Switching to Ultra:
+ * - never configured (no embedding provider chosen yet) → open the
+ * one-time activation wizard instead of calling the route blind;
+ * - already configured → `POST /api/ultrawiki/activate` with the stored
+ * slot choices (idempotent re-persist on the backend).
+ * Switching to Normal: a confirm dialog whose copy states that nothing is
+ * deleted (decision D-9 — both directions are safe and reversible), then
+ * `POST /api/ultrawiki/deactivate`.
+ */
+import { Suspense, lazy, useState } from "react";
+import { Loader2, Sparkles } from "lucide-react";
+
+import { Button } from "@/components/ui/button";
+import { cn } from "@/lib/utils";
+import { useT } from "@/i18n";
+import { useEventStore } from "@/store/events";
+import {
+ activateUltraWiki,
+ deactivateUltraWiki,
+ type UltraWikiStatus,
+} from "@/lib/ultrawikiApi";
+
+// Lazy: the wizard (and its provider cards) only loads when a never-configured
+// install actually opens it — same pattern as WikiGraph in WikiView.
+const ActivationWizard = lazy(() =>
+ import("@/components/ultrawiki/ActivationWizard").then((mod) => ({
+ default: mod.ActivationWizard,
+ })),
+);
+
+export function UltraModeSwitch({
+ status,
+ onModeChanged,
+}: {
+ status: UltraWikiStatus | null;
+ onModeChanged: () => void;
+}): JSX.Element {
+ const t = useT();
+ const pushToast = useEventStore((s) => s.pushToast);
+ const [pending, setPending] = useState(false);
+ const [wizardOpen, setWizardOpen] = useState(false);
+ const [confirmOpen, setConfirmOpen] = useState(false);
+
+ const enabled = status?.enabled === true;
+ // "Configured before" = an embedding provider was ever chosen; only then can
+ // activation succeed without the wizard's one-time slot choices.
+ const configuredProvider = status?.slots?.embedding?.provider ?? "";
+
+ async function switchToUltra() {
+ if (enabled || pending) return;
+ if (!configuredProvider) {
+ setWizardOpen(true);
+ return;
+ }
+ setPending(true);
+ try {
+ await activateUltraWiki({ embedding_provider: configuredProvider });
+ pushToast("success", t("ultrawiki.mode.activated"));
+ onModeChanged();
+ } catch (e) {
+ pushToast(
+ "error",
+ t("ultrawiki.mode.activate_failed").replace("{0}", (e as Error).message),
+ );
+ } finally {
+ setPending(false);
+ }
+ }
+
+ async function switchToNormal() {
+ setConfirmOpen(false);
+ setPending(true);
+ try {
+ await deactivateUltraWiki();
+ pushToast("success", t("ultrawiki.mode.deactivated"));
+ onModeChanged();
+ } catch (e) {
+ pushToast(
+ "error",
+ t("ultrawiki.mode.deactivate_failed").replace(
+ "{0}",
+ (e as Error).message,
+ ),
+ );
+ } finally {
+ setPending(false);
+ }
+ }
+
+ return (
+ <>
+ <div
+ className="inline-flex items-center gap-1 rounded-lg border border-border bg-card/60 p-1"
+ role="group"
+ aria-label={t("ultrawiki.mode.aria")}
+ data-testid="wiki-mode-toggle"
+ data-mode={enabled ? "ultra" : "normal"}
+ >
+ <ModeButton
+ active={!enabled}
+ disabled={pending}
+ label={t("ultrawiki.mode.normal")}
+ testId="wiki-mode-normal"
+ onClick={() => {
+ if (enabled && !pending) setConfirmOpen(true);
+ }}
+ />
+ <ModeButton
+ active={enabled}
+ disabled={pending}
+ label={t("ultrawiki.mode.ultra")}
+ icon={
+ pending ? (
+ <Loader2 className="h-3 w-3 animate-spin" aria-hidden />
+ ) : (
+ <Sparkles className="h-3 w-3" aria-hidden />
+ )
+ }
+ testId="wiki-mode-ultra"
+ onClick={() => void switchToUltra()}
+ />
+ </div>
+
+ {confirmOpen && (
+ <div
+ className="fixed inset-0 z-[70] flex items-center justify-center bg-background/80 backdrop-blur-sm"
+ role="dialog"
+ aria-modal="true"
+ aria-labelledby="ultrawiki-deactivate-title"
+ data-testid="ultrawiki-deactivate-confirm"
+ onClick={(e) => {
+ if (e.target === e.currentTarget) setConfirmOpen(false);
+ }}
+ >
+ <div
+ className="w-full max-w-md rounded-2xl border border-border bg-card p-6 shadow-2xl"
+ onClick={(e) => e.stopPropagation()}
+ >
+ <h2
+ id="ultrawiki-deactivate-title"
+ className="text-base font-semibold text-foreground"
+ >
+ {t("ultrawiki.mode.deactivate_title")}
+ </h2>
+ {/* D-9: switching back never deletes anything — say so plainly. */}
+ <p className="mt-2 text-sm leading-relaxed text-muted-foreground">
+ {t("ultrawiki.mode.deactivate_body")}
+ </p>
+ <div className="mt-4 flex justify-end gap-2">
+ <Button
+ variant="outline"
+ size="sm"
+ onClick={() => setConfirmOpen(false)}
+ >
+ {t("ultrawiki.mode.cancel")}
+ </Button>
+ <Button
+ size="sm"
+ onClick={() => void switchToNormal()}
+ data-testid="ultrawiki-deactivate-confirm-button"
+ >
+ {t("ultrawiki.mode.deactivate_confirm")}
+ </Button>
+ </div>
+ </div>
+ </div>
+ )}
+
+ {wizardOpen && (
+ <Suspense fallback={<WizardLoadingOverlay />}>
+ <ActivationWizard
+ onClose={() => setWizardOpen(false)}
+ onActivated={() => {
+ setWizardOpen(false);
+ onModeChanged();
+ }}
+ />
+ </Suspense>
+ )}
+ </>
+ );
+}
+
+function ModeButton({
+ active,
+ disabled,
+ label,
+ icon,
+ testId,
+ onClick,
+}: {
+ active: boolean;
+ disabled: boolean;
+ label: string;
+ icon?: React.ReactNode;
+ testId: string;
+ onClick: () => void;
+}): JSX.Element {
+ return (
+ <button
+ type="button"
+ onClick={onClick}
+ disabled={disabled}
+ aria-pressed={active}
+ data-testid={testId}
+ className={cn(
+ "inline-flex items-center gap-1.5 rounded-md px-3 py-1 text-xs transition-colors",
+ active
+ ? "bg-primary/15 font-medium text-foreground ring-1 ring-primary/50"
+ : "text-muted-foreground hover:text-foreground",
+ disabled && "cursor-not-allowed opacity-60",
+ )}
+ >
+ {icon}
+ {label}
+ </button>
+ );
+}
+
+function WizardLoadingOverlay(): JSX.Element {
+ return (
+ <div className="fixed inset-0 z-[70] flex items-center justify-center bg-background/80 backdrop-blur-sm">
+ <Loader2 className="h-5 w-5 animate-spin text-muted-foreground" />
+ </div>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.json
index 336bd078c8..b211fdae33 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json
@@ -2636,5 +2636,169 @@
"result_sent": "Danke — wurde an unseren Discord gesendet!",
"result_not_configured": "Feedback-Kanal ist noch nicht eingerichtet — es wurde nichts gesendet.",
"result_error": "Discord nicht erreichbar, bitte später erneut versuchen."
+ },
+ "ultrawiki": {
+ "mode": {
+ "normal": "Normal",
+ "ultra": "Ultra",
+ "aria": "Wiki-Modus",
+ "activated": "Ultra-Modus ist an.",
+ "deactivated": "Ultra-Modus ist aus — das normale Wiki antwortet wieder.",
+ "activate_failed": "Konnte nicht in den Ultra-Modus wechseln: {0}",
+ "deactivate_failed": "Konnte nicht zum normalen Wiki zurückwechseln: {0}",
+ "deactivate_title": "Zurück zum normalen Wiki wechseln?",
+ "deactivate_body": "Es wird nichts gelöscht: Jedes aufgenommene Element, jedes Embedding und jede Quelle bleibt auf der Festplatte. Der Ultra-Modus pausiert nur — beim Wiedereinschalten geht es genau dort weiter, wo du aufgehört hast.",
+ "deactivate_confirm": "Zu Normal wechseln",
+ "cancel": "Abbrechen"
+ },
+ "panel": {
+ "tab_ask": "Fragen",
+ "tab_sources": "Quellen",
+ "tab_settings": "Einstellungen",
+ "loading": "UltraWiki-Status wird geladen…",
+ "status_unavailable": "UltraWiki-Status nicht verfügbar — läuft das Backend?",
+ "embedding_dead": "Der Embedding-Slot ist nicht bereit ({0}). Stichwort- und Zeit-Antworten funktionieren weiter; die semantische Suche pausiert, bis der Slot repariert ist.",
+ "open_settings": "Einstellungen öffnen"
+ },
+ "progress": {
+ "title": "Import-Pipeline",
+ "stage_captured": "Erfasst",
+ "stage_keyword_indexed": "Stichwort-durchsuchbar",
+ "stage_embedded": "Eingebettet",
+ "stage_distilled": "Destilliert",
+ "stage_failed": "Fehlgeschlagen",
+ "pipeline_running": "Pipeline läuft",
+ "pipeline_idle": "Pipeline wartet",
+ "cancel": "Abbrechen",
+ "cancel_failed": "Job konnte nicht abgebrochen werden: {0}"
+ },
+ "sources": {
+ "title": "Verbundene Quellen",
+ "empty": "Noch keine Quellen — füge oben eine hinzu.",
+ "consent_pending": "Freigabe ausstehend",
+ "consent_approved": "Freigegeben",
+ "consent_revoked": "Widerrufen",
+ "approve": "Freigeben",
+ "approve_scope": "Mit der Freigabe darf diese Quelle gelesen und in deinen privaten Wissensspeicher aufgenommen werden. Vor der Freigabe wird nichts abgerufen.",
+ "revoke": "Widerrufen",
+ "sync_now": "Jetzt synchronisieren",
+ "sync_started": "Synchronisierung gestartet.",
+ "action_failed": "Aktion fehlgeschlagen: {0}",
+ "last_sync": "Letzte Synchronisierung: {0}",
+ "never_synced": "Noch nie synchronisiert",
+ "last_error": "Letzter Fehler: {0}",
+ "areas": "Bereiche: {0}",
+ "add_source": "Quelle hinzufügen",
+ "add_title": "Quelle hinzufügen",
+ "connector_label": "Quellentyp",
+ "label_label": "Name",
+ "path_label": "Ordnerpfad",
+ "path_hint": "Der Ordner wird auf diesem Gerät gelesen; vor Freigabe und Synchronisierung wird nichts abgerufen.",
+ "areas_label": "Bereiche",
+ "no_areas": "Bis du weitere anlegst, wird der Standardbereich verwendet.",
+ "bridge_label": "Verbundene Integration",
+ "bridge_empty": "Keine verbundenen Integrationen gefunden (Marketplace-Plugins oder MCP-Server).",
+ "bridge_load_failed": "Integrationsliste konnte nicht geladen werden.",
+ "adapter_pending": "Pull-Adapter ausstehend",
+ "adapter_pending_hint": "Diese Integration lässt sich registrieren, aber ihr Pull-Adapter ist noch nicht gebaut — eine Synchronisierung findet nichts, bis er erscheint.",
+ "create": "Quelle registrieren",
+ "create_hint": "Die Quelle startet als ausstehend — gib sie frei, bevor etwas gelesen wird.",
+ "create_failed": "Quelle konnte nicht registriert werden: {0}",
+ "cancel": "Abbrechen",
+ "connector_obsidian": "Obsidian-Vault",
+ "connector_local_folder": "Lokaler Ordner",
+ "connector_conversations": "Unterhaltungen mit {name}",
+ "connector_normal_wiki": "Eingebautes Wiki",
+ "connector_plugin_bridge": "Verbundene Integration (Plugins / MCP)"
+ },
+ "ask": {
+ "placeholder": "Frag dein Wissen…",
+ "searching": "Suche läuft…",
+ "no_results": "Keine Treffer für \"{0}\".",
+ "search_failed": "Suche fehlgeschlagen: {0}",
+ "open_source": "Original öffnen",
+ "matched_keyword": "Stichwort",
+ "matched_vector": "semantisch",
+ "leg_keyword_on": "Stichwortsuche: an",
+ "leg_vector_on": "Semantische Suche: an",
+ "leg_vector_off": "Semantische Suche: aus — {0}",
+ "leg_rerank_on": "Rerank: an",
+ "leg_rerank_off": "Rerank: aus"
+ },
+ "slots": {
+ "title": "Fähigkeits-Slots",
+ "storage_title": "Speicher",
+ "storage_desc": "Wo der Wissensspeicher liegt.",
+ "storage_sqlite": "SQLite — lokale Datei, keine Einrichtung",
+ "storage_postgres": "PostgreSQL — über gespeicherte Verbindungszeichenfolge",
+ "storage_postgres_hint": "Die Verbindungszeichenfolge ist ein Geheimnis. Speichere sie als 'ultrawiki_db_url' in der API-Keys-Ansicht; hier wird sie nie eingegeben.",
+ "open_api_keys": "API-Keys öffnen",
+ "in_use": "In Benutzung: {0}",
+ "embedding_title": "Embedding-Modell",
+ "embedding_desc": "Wandelt Text in Vektoren für die semantische Suche um. Ein Wechsel bettet alles neu ein.",
+ "provider_label": "Anbieter",
+ "model_label": "Modell",
+ "model_default_placeholder": "Anbieter-Standard ({0})",
+ "distill_title": "Destillations-Modell",
+ "distill_desc": "Fasst aufgenommene Elemente im Hintergrund zusammen. Gilt nur für neue Arbeit.",
+ "distill_auto": "Automatisch — erster bereiter Chat-Anbieter",
+ "distill_chain": "Bereite Chat-Anbieter: {0}",
+ "distill_chain_empty": "Kein Chat-Anbieter mit gültigen Zugangsdaten gefunden.",
+ "rerank_title": "Rerank (optional)",
+ "rerank_desc": "Sortiert die fusionierten Treffer neu; die Suche funktioniert auch ohne.",
+ "rerank_off": "Aus",
+ "not_ready_suffix": "nicht bereit",
+ "apply": "Übernehmen",
+ "applying": "Wird übernommen…",
+ "applied": "Slot-Einstellungen übernommen.",
+ "apply_failed": "Konnte nicht übernommen werden: {0}",
+ "reembed_started": "Das Neu-Einbetten läuft im Hintergrund — die Stichwortsuche funktioniert währenddessen weiter.",
+ "reembed_title": "Alles neu einbetten?",
+ "reembed_body": "Ein Wechsel von Embedding-Anbieter oder -Modell wechselt den Vektorraum: {0} bereits eingebettete Elemente werden verworfen und im Hintergrund neu eingebettet. Die Stichwortsuche funktioniert währenddessen weiter.",
+ "reembed_confirm": "{0} Elemente neu einbetten",
+ "test": "Testen",
+ "testing": "Teste…",
+ "test_ok": "OK",
+ "test_failed": "Fehlgeschlagen",
+ "current": "Aktuell: {0}"
+ },
+ "wizard": {
+ "title": "Ultra-Modus einschalten",
+ "subtitle": "Ein paar einmalige Entscheidungen. Alles bleibt danach in den Einstellungen änderbar — außer dem Embedding-Modell, dessen Wechsel alles neu einbettet.",
+ "step_storage": "Speicher",
+ "step_embedding": "Embedding",
+ "step_optional": "Destillation & Rerank",
+ "step_review": "Prüfen",
+ "storage_intro": "Wo soll der Wissensspeicher liegen?",
+ "embedding_intro": "Welches Modell soll deinen Text in durchsuchbare Vektoren umwandeln?",
+ "embedding_tradeoff": "Cloud = höhere Qualität und kein Download, aber dein Text geht an diesen Anbieter. Lokal (Ollama) = privat und offline, einmaliger Modell-Download, braucht etwas Hardware.",
+ "embedding_permanent": "Diese Wahl ist bewusst: Ein späterer Wechsel bettet deinen gesamten Speicher neu ein.",
+ "embedding_not_ready": "Nicht bereit: {0}",
+ "embedding_none_ready": "Keine deiner Embedding-Optionen ist bisher bereit. Richte einen Anbieter-Schlüssel in der API-Keys-Ansicht ein oder starte Ollama und komm dann zurück.",
+ "local_chip": "Lokal",
+ "cloud_chip": "Cloud",
+ "default_model": "Standardmodell: {0}",
+ "optional_intro": "Beides ist optional und lässt sich später gefahrlos ändern.",
+ "distill_label": "Destillation",
+ "distill_auto": "Automatisch — nutze deine bereiten Chat-Anbieter (empfohlen)",
+ "distill_local": "Lokal über Ollama",
+ "distill_privacy_hint": "An deine Embedding-Privatsphäre angepasst — jederzeit überschreibbar.",
+ "rerank_label": "Rerank",
+ "rerank_off": "Aus (für den Anfang empfohlen)",
+ "review_intro": "Bereit zur Aktivierung. Es wird noch nichts gelesen: Jede Quelle startet als ausstehend, bis du sie freigibst.",
+ "review_storage": "Speicher",
+ "review_embedding": "Embedding",
+ "review_distill": "Destillation",
+ "review_rerank": "Rerank",
+ "auto": "Automatisch",
+ "off": "Aus",
+ "activate": "Ultra-Modus aktivieren",
+ "activating": "Aktiviere…",
+ "activate_failed": "Aktivierung fehlgeschlagen: {0}",
+ "done": "Fertig",
+ "back": "Zurück",
+ "next": "Weiter",
+ "close": "Schließen"
+ }
}
}
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.json
index 2f82565099..a7f18595ba 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json
@@ -2637,5 +2637,169 @@
"result_sent": "Thanks — sent to our Discord!",
"result_not_configured": "Feedback channel isn't set up yet — nothing was sent.",
"result_error": "Couldn't reach Discord, please try again later."
+ },
+ "ultrawiki": {
+ "mode": {
+ "normal": "Normal",
+ "ultra": "Ultra",
+ "aria": "Wiki mode",
+ "activated": "Ultra mode is on.",
+ "deactivated": "Ultra mode is off — the normal wiki answers again.",
+ "activate_failed": "Could not switch to Ultra mode: {0}",
+ "deactivate_failed": "Could not switch back to the normal wiki: {0}",
+ "deactivate_title": "Switch back to the normal wiki?",
+ "deactivate_body": "Nothing is deleted: every ingested item, embedding, and source stays on disk. Ultra mode only pauses, and switching it back on picks up exactly where you left off.",
+ "deactivate_confirm": "Switch to Normal",
+ "cancel": "Cancel"
+ },
+ "panel": {
+ "tab_ask": "Ask",
+ "tab_sources": "Sources",
+ "tab_settings": "Settings",
+ "loading": "Loading UltraWiki status…",
+ "status_unavailable": "UltraWiki status is unavailable — is the backend running?",
+ "embedding_dead": "The embedding slot is not ready ({0}). Keyword and time-based answers still work; semantic search is paused until the slot is fixed.",
+ "open_settings": "Open settings"
+ },
+ "progress": {
+ "title": "Import pipeline",
+ "stage_captured": "Captured",
+ "stage_keyword_indexed": "Keyword-searchable",
+ "stage_embedded": "Embedded",
+ "stage_distilled": "Distilled",
+ "stage_failed": "Failed",
+ "pipeline_running": "Pipeline running",
+ "pipeline_idle": "Pipeline idle",
+ "cancel": "Cancel",
+ "cancel_failed": "Could not cancel the job: {0}"
+ },
+ "sources": {
+ "title": "Connected sources",
+ "empty": "No sources yet — add one above.",
+ "consent_pending": "Pending approval",
+ "consent_approved": "Approved",
+ "consent_revoked": "Revoked",
+ "approve": "Approve",
+ "approve_scope": "Approving lets this source be read and indexed into your private knowledge store. Nothing is pulled before you approve.",
+ "revoke": "Revoke",
+ "sync_now": "Sync now",
+ "sync_started": "Sync started.",
+ "action_failed": "Action failed: {0}",
+ "last_sync": "Last sync: {0}",
+ "never_synced": "Never synced",
+ "last_error": "Last error: {0}",
+ "areas": "Areas: {0}",
+ "add_source": "Add source",
+ "add_title": "Add a source",
+ "connector_label": "Source type",
+ "label_label": "Name",
+ "path_label": "Folder path",
+ "path_hint": "The folder is read on this machine; nothing is pulled before you approve and sync.",
+ "areas_label": "Areas",
+ "no_areas": "The default area is used until you create more.",
+ "bridge_label": "Connected integration",
+ "bridge_empty": "No connected integrations found (marketplace plugins or MCP servers).",
+ "bridge_load_failed": "Could not load the integration list.",
+ "adapter_pending": "pull adapter pending",
+ "adapter_pending_hint": "This integration can be registered, but its pull adapter is not built yet — a sync will find nothing until it ships.",
+ "create": "Register source",
+ "create_hint": "The source starts as pending — approve it before anything is read.",
+ "create_failed": "Could not register the source: {0}",
+ "cancel": "Cancel",
+ "connector_obsidian": "Obsidian vault",
+ "connector_local_folder": "Local folder",
+ "connector_conversations": "Conversations with {name}",
+ "connector_normal_wiki": "Built-in wiki",
+ "connector_plugin_bridge": "Connected integration (plugins / MCP)"
+ },
+ "ask": {
+ "placeholder": "Ask your knowledge…",
+ "searching": "Searching…",
+ "no_results": "No hits for \"{0}\".",
+ "search_failed": "Search failed: {0}",
+ "open_source": "Open original",
+ "matched_keyword": "keyword",
+ "matched_vector": "semantic",
+ "leg_keyword_on": "Keyword search: on",
+ "leg_vector_on": "Semantic search: on",
+ "leg_vector_off": "Semantic search: off — {0}",
+ "leg_rerank_on": "Rerank: on",
+ "leg_rerank_off": "Rerank: off"
+ },
+ "slots": {
+ "title": "Capability slots",
+ "storage_title": "Storage",
+ "storage_desc": "Where the knowledge store lives.",
+ "storage_sqlite": "SQLite — local file, zero setup",
+ "storage_postgres": "PostgreSQL — via saved connection string",
+ "storage_postgres_hint": "The connection string is a secret. Save it as 'ultrawiki_db_url' in the API-Keys view; it is never entered here.",
+ "open_api_keys": "Open API-Keys",
+ "in_use": "In use: {0}",
+ "embedding_title": "Embedding model",
+ "embedding_desc": "Turns text into vectors for semantic search. Changing it re-embeds everything.",
+ "provider_label": "Provider",
+ "model_label": "Model",
+ "model_default_placeholder": "Provider default ({0})",
+ "distill_title": "Distillation model",
+ "distill_desc": "Summarizes ingested items in the background. Applies to new work only.",
+ "distill_auto": "Automatic — first ready chat provider",
+ "distill_chain": "Ready chat providers: {0}",
+ "distill_chain_empty": "No credential-ready chat provider found.",
+ "rerank_title": "Rerank (optional)",
+ "rerank_desc": "Re-orders the fused hits; search works without it.",
+ "rerank_off": "Off",
+ "not_ready_suffix": "not ready",
+ "apply": "Apply",
+ "applying": "Applying…",
+ "applied": "Slot settings applied.",
+ "apply_failed": "Could not apply: {0}",
+ "reembed_started": "Re-embedding runs in the background — keyword search keeps working meanwhile.",
+ "reembed_title": "Re-embed everything?",
+ "reembed_body": "Changing the embedding provider or model switches vector spaces: {0} already-embedded items will be dropped and re-embedded in the background. Keyword search keeps working meanwhile.",
+ "reembed_confirm": "Re-embed {0} items",
+ "test": "Test",
+ "testing": "Testing…",
+ "test_ok": "OK",
+ "test_failed": "Failed",
+ "current": "Current: {0}"
+ },
+ "wizard": {
+ "title": "Turn on Ultra mode",
+ "subtitle": "A few one-time choices. Everything stays editable in the settings afterwards — except the embedding model, which re-embeds everything when changed.",
+ "step_storage": "Storage",
+ "step_embedding": "Embedding",
+ "step_optional": "Distill & rerank",
+ "step_review": "Review",
+ "storage_intro": "Where should the knowledge store live?",
+ "embedding_intro": "Which model should turn your text into searchable vectors?",
+ "embedding_tradeoff": "Cloud = higher quality and no download, but your text goes to that provider. Local (Ollama) = private and offline, one-time model download, needs some hardware.",
+ "embedding_permanent": "This choice is deliberate: changing it later re-embeds your entire store.",
+ "embedding_not_ready": "Not ready: {0}",
+ "embedding_none_ready": "None of your embedding options is ready yet. Set up a provider key in the API-Keys view or start Ollama, then come back.",
+ "local_chip": "Local",
+ "cloud_chip": "Cloud",
+ "default_model": "Default model: {0}",
+ "optional_intro": "Both are optional and safe to change later.",
+ "distill_label": "Distillation",
+ "distill_auto": "Automatic — use your ready chat providers (recommended)",
+ "distill_local": "Local via Ollama",
+ "distill_privacy_hint": "Matched to your embedding privacy stance — override freely.",
+ "rerank_label": "Rerank",
+ "rerank_off": "Off (recommended to start)",
+ "review_intro": "Ready to activate. Nothing is read yet: every source starts as pending until you approve it.",
+ "review_storage": "Storage",
+ "review_embedding": "Embedding",
+ "review_distill": "Distillation",
+ "review_rerank": "Rerank",
+ "auto": "Automatic",
+ "off": "Off",
+ "activate": "Activate Ultra mode",
+ "activating": "Activating…",
+ "activate_failed": "Activation failed: {0}",
+ "done": "Done",
+ "back": "Back",
+ "next": "Next",
+ "close": "Close"
+ }
}
}
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.json
index 01bce7363d..76c2a6d6a7 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json
@@ -75,7 +75,8 @@
"taskbar": "Barra",
"contacts": "Contactos",
"feedback": "Comentarios",
- "agent_instructions": "{name}.md"
+ "agent_instructions": "{name}.md",
+ "agentic_ide": "IDE agéntico"
},
"agent_instructions": {
"subtitle": "Tus preferencias personales sobre cómo el asistente trabaja contigo — tono, idioma, valores por defecto, hechos permanentes. Separado del System Prompt y nunca anula la seguridad ni las confirmaciones.",
@@ -2636,5 +2637,169 @@
"result_sent": "¡Gracias — enviado a nuestro Discord!",
"result_not_configured": "El canal de comentarios aún no está configurado — no se envió nada.",
"result_error": "No se pudo llegar a Discord, inténtalo de nuevo más tarde."
+ },
+ "ultrawiki": {
+ "mode": {
+ "normal": "Normal",
+ "ultra": "Ultra",
+ "aria": "Modo del wiki",
+ "activated": "El modo Ultra está activado.",
+ "deactivated": "El modo Ultra está desactivado — el wiki normal vuelve a responder.",
+ "activate_failed": "No se pudo cambiar al modo Ultra: {0}",
+ "deactivate_failed": "No se pudo volver al wiki normal: {0}",
+ "deactivate_title": "¿Volver al wiki normal?",
+ "deactivate_body": "No se borra nada: cada elemento ingerido, cada embedding y cada fuente permanecen en el disco. El modo Ultra solo se pausa, y al reactivarlo continúa exactamente donde lo dejaste.",
+ "deactivate_confirm": "Cambiar a Normal",
+ "cancel": "Cancelar"
+ },
+ "panel": {
+ "tab_ask": "Preguntar",
+ "tab_sources": "Fuentes",
+ "tab_settings": "Ajustes",
+ "loading": "Cargando el estado de UltraWiki…",
+ "status_unavailable": "El estado de UltraWiki no está disponible — ¿está funcionando el backend?",
+ "embedding_dead": "La ranura de embeddings no está lista ({0}). Las respuestas por palabras clave y por fecha siguen funcionando; la búsqueda semántica queda en pausa hasta arreglar la ranura.",
+ "open_settings": "Abrir ajustes"
+ },
+ "progress": {
+ "title": "Canal de importación",
+ "stage_captured": "Capturado",
+ "stage_keyword_indexed": "Buscable por palabras clave",
+ "stage_embedded": "Con embeddings",
+ "stage_distilled": "Destilado",
+ "stage_failed": "Fallido",
+ "pipeline_running": "Canal en marcha",
+ "pipeline_idle": "Canal en espera",
+ "cancel": "Cancelar",
+ "cancel_failed": "No se pudo cancelar el trabajo: {0}"
+ },
+ "sources": {
+ "title": "Fuentes conectadas",
+ "empty": "Aún no hay fuentes — añade una arriba.",
+ "consent_pending": "Aprobación pendiente",
+ "consent_approved": "Aprobada",
+ "consent_revoked": "Revocada",
+ "approve": "Aprobar",
+ "approve_scope": "Al aprobar, esta fuente puede leerse e indexarse en tu almacén de conocimiento privado. No se extrae nada antes de tu aprobación.",
+ "revoke": "Revocar",
+ "sync_now": "Sincronizar ahora",
+ "sync_started": "Sincronización iniciada.",
+ "action_failed": "La acción falló: {0}",
+ "last_sync": "Última sincronización: {0}",
+ "never_synced": "Nunca sincronizada",
+ "last_error": "Último error: {0}",
+ "areas": "Áreas: {0}",
+ "add_source": "Añadir fuente",
+ "add_title": "Añadir una fuente",
+ "connector_label": "Tipo de fuente",
+ "label_label": "Nombre",
+ "path_label": "Ruta de la carpeta",
+ "path_hint": "La carpeta se lee en este equipo; no se extrae nada antes de aprobar y sincronizar.",
+ "areas_label": "Áreas",
+ "no_areas": "Se usa el área por defecto hasta que crees más.",
+ "bridge_label": "Integración conectada",
+ "bridge_empty": "No se encontraron integraciones conectadas (plugins del marketplace o servidores MCP).",
+ "bridge_load_failed": "No se pudo cargar la lista de integraciones.",
+ "adapter_pending": "adaptador de extracción pendiente",
+ "adapter_pending_hint": "Esta integración puede registrarse, pero su adaptador de extracción aún no está construido — una sincronización no encontrará nada hasta que llegue.",
+ "create": "Registrar fuente",
+ "create_hint": "La fuente empieza como pendiente — apruébala antes de que se lea nada.",
+ "create_failed": "No se pudo registrar la fuente: {0}",
+ "cancel": "Cancelar",
+ "connector_obsidian": "Vault de Obsidian",
+ "connector_local_folder": "Carpeta local",
+ "connector_conversations": "Conversaciones con {name}",
+ "connector_normal_wiki": "Wiki integrado",
+ "connector_plugin_bridge": "Integración conectada (plugins / MCP)"
+ },
+ "ask": {
+ "placeholder": "Pregunta a tu conocimiento…",
+ "searching": "Buscando…",
+ "no_results": "Sin resultados para \"{0}\".",
+ "search_failed": "La búsqueda falló: {0}",
+ "open_source": "Abrir original",
+ "matched_keyword": "palabra clave",
+ "matched_vector": "semántico",
+ "leg_keyword_on": "Búsqueda por palabras clave: activada",
+ "leg_vector_on": "Búsqueda semántica: activada",
+ "leg_vector_off": "Búsqueda semántica: desactivada — {0}",
+ "leg_rerank_on": "Rerank: activado",
+ "leg_rerank_off": "Rerank: desactivado"
+ },
+ "slots": {
+ "title": "Ranuras de capacidades",
+ "storage_title": "Almacenamiento",
+ "storage_desc": "Dónde vive el almacén de conocimiento.",
+ "storage_sqlite": "SQLite — archivo local, sin configuración",
+ "storage_postgres": "PostgreSQL — mediante cadena de conexión guardada",
+ "storage_postgres_hint": "La cadena de conexión es un secreto. Guárdala como 'ultrawiki_db_url' en la vista API-Keys; aquí nunca se introduce.",
+ "open_api_keys": "Abrir API-Keys",
+ "in_use": "En uso: {0}",
+ "embedding_title": "Modelo de embeddings",
+ "embedding_desc": "Convierte el texto en vectores para la búsqueda semántica. Cambiarlo vuelve a incrustar todo.",
+ "provider_label": "Proveedor",
+ "model_label": "Modelo",
+ "model_default_placeholder": "Predeterminado del proveedor ({0})",
+ "distill_title": "Modelo de destilación",
+ "distill_desc": "Resume los elementos ingeridos en segundo plano. Solo aplica al trabajo nuevo.",
+ "distill_auto": "Automático — primer proveedor de chat listo",
+ "distill_chain": "Proveedores de chat listos: {0}",
+ "distill_chain_empty": "No se encontró ningún proveedor de chat con credenciales válidas.",
+ "rerank_title": "Rerank (opcional)",
+ "rerank_desc": "Reordena los resultados fusionados; la búsqueda funciona sin él.",
+ "rerank_off": "Desactivado",
+ "not_ready_suffix": "no listo",
+ "apply": "Aplicar",
+ "applying": "Aplicando…",
+ "applied": "Ajustes de ranuras aplicados.",
+ "apply_failed": "No se pudo aplicar: {0}",
+ "reembed_started": "La re-incrustación se ejecuta en segundo plano — la búsqueda por palabras clave sigue funcionando mientras tanto.",
+ "reembed_title": "¿Volver a incrustar todo?",
+ "reembed_body": "Cambiar el proveedor o el modelo de embeddings cambia el espacio vectorial: {0} elementos ya incrustados se descartarán y se volverán a incrustar en segundo plano. La búsqueda por palabras clave sigue funcionando mientras tanto.",
+ "reembed_confirm": "Volver a incrustar {0} elementos",
+ "test": "Probar",
+ "testing": "Probando…",
+ "test_ok": "OK",
+ "test_failed": "Falló",
+ "current": "Actual: {0}"
+ },
+ "wizard": {
+ "title": "Activar el modo Ultra",
+ "subtitle": "Unas pocas decisiones únicas. Todo sigue siendo editable después en los ajustes — salvo el modelo de embeddings, cuyo cambio vuelve a incrustar todo.",
+ "step_storage": "Almacenamiento",
+ "step_embedding": "Embeddings",
+ "step_optional": "Destilación y rerank",
+ "step_review": "Revisión",
+ "storage_intro": "¿Dónde debe vivir el almacén de conocimiento?",
+ "embedding_intro": "¿Qué modelo debe convertir tu texto en vectores buscables?",
+ "embedding_tradeoff": "Nube = mayor calidad y sin descarga, pero tu texto va a ese proveedor. Local (Ollama) = privado y sin conexión, descarga única del modelo, requiere algo de hardware.",
+ "embedding_permanent": "Esta elección es deliberada: cambiarla más adelante vuelve a incrustar todo tu almacén.",
+ "embedding_not_ready": "No listo: {0}",
+ "embedding_none_ready": "Ninguna de tus opciones de embeddings está lista todavía. Configura una clave de proveedor en la vista API-Keys o inicia Ollama, y vuelve después.",
+ "local_chip": "Local",
+ "cloud_chip": "Nube",
+ "default_model": "Modelo predeterminado: {0}",
+ "optional_intro": "Ambos son opcionales y se pueden cambiar después sin riesgo.",
+ "distill_label": "Destilación",
+ "distill_auto": "Automático — usa tus proveedores de chat listos (recomendado)",
+ "distill_local": "Local mediante Ollama",
+ "distill_privacy_hint": "Ajustado a tu postura de privacidad de embeddings — puedes cambiarlo libremente.",
+ "rerank_label": "Rerank",
+ "rerank_off": "Desactivado (recomendado para empezar)",
+ "review_intro": "Listo para activar. Aún no se lee nada: cada fuente empieza como pendiente hasta que la apruebes.",
+ "review_storage": "Almacenamiento",
+ "review_embedding": "Embeddings",
+ "review_distill": "Destilación",
+ "review_rerank": "Rerank",
+ "auto": "Automático",
+ "off": "Desactivado",
+ "activate": "Activar el modo Ultra",
+ "activating": "Activando…",
+ "activate_failed": "La activación falló: {0}",
+ "done": "Hecho",
+ "back": "Atrás",
+ "next": "Siguiente",
+ "close": "Cerrar"
+ }
}
}
diff --git a/jarvis/ui/web/frontend/src/i18n/ultrawiki-i18n-parity.test.ts b/jarvis/ui/web/frontend/src/i18n/ultrawiki-i18n-parity.test.ts
new file mode 100644
index 0000000000..c2ba9bcc3c
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/i18n/ultrawiki-i18n-parity.test.ts
@@ -0,0 +1,36 @@
+import { describe, expect, it } from "vitest";
+import en from "./locales/en.json";
+import de from "./locales/de.json";
+import es from "./locales/es.json";
+
+function flatten(obj: Record<string, unknown>, prefix = ""): string[] {
+ const out: string[] = [];
+ for (const [k, v] of Object.entries(obj)) {
+ const key = prefix ? `${prefix}.${k}` : k;
+ if (v && typeof v === "object" && !Array.isArray(v)) {
+ out.push(...flatten(v as Record<string, unknown>, key));
+ } else {
+ out.push(key);
+ }
+ }
+ return out;
+}
+
+const keysFor = (loc: Record<string, unknown>): Set<string> =>
+ new Set(flatten((loc.ultrawiki ?? {}) as Record<string, unknown>));
+
+describe("ultrawiki i18n parity", () => {
+ it("en defines a non-trivial ultrawiki key set", () => {
+ expect(keysFor(en as Record<string, unknown>).size).toBeGreaterThan(50);
+ });
+
+ for (const [lang, loc] of [["de", de], ["es", es]] as const) {
+ it(`${lang} has the same ultrawiki keys as en`, () => {
+ const enKeys = keysFor(en as Record<string, unknown>);
+ const langKeys = keysFor(loc as Record<string, unknown>);
+ const missing = [...enKeys].filter((k) => !langKeys.has(k));
+ const extra = [...langKeys].filter((k) => !enKeys.has(k));
+ expect({ missing, extra }).toEqual({ missing: [], extra: [] });
+ });
+ }
+});
diff --git a/jarvis/ui/web/frontend/src/lib/ultrawikiApi.ts b/jarvis/ui/web/frontend/src/lib/ultrawikiApi.ts
new file mode 100644
index 0000000000..3f1fef292a
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/lib/ultrawikiApi.ts
@@ -0,0 +1,430 @@
+/**
+ * Typed fetchers for the UltraWiki REST surface
+ * (`jarvis/ui/web/ultrawiki_routes.py`).
+ *
+ * Contract notes (mirror the route module's docstring):
+ * - `GET /api/ultrawiki/status` ALWAYS answers, even while the mode is off —
+ * it is the honesty surface. `fetchUltraWikiStatus` therefore swallows
+ * network failures and returns `null` (same idiom as `fetchWikiHealth`),
+ * because it is polled and a transient blip must not surface as an
+ * unhandled rejection.
+ * - Search answers 409 (not 503) while the mode switch is off; 503 means the
+ * service is not wired yet (app still starting). Both arrive here as an
+ * {@link UltraWikiApiError} carrying the backend's honest `detail`.
+ */
+
+// Mirrors jarvis/ultrawiki/types.py::ItemState — five-layer anti-drift
+// discipline (AP-4 / BUG-008): never retype these values elsewhere.
+export type UltraWikiItemState =
+ | "captured"
+ | "keyword_indexed"
+ | "embedded"
+ | "distilled"
+ | "failed";
+
+// Mirrors jarvis/ultrawiki/types.py::ConsentState.
+export type UltraWikiConsent = "pending" | "approved" | "revoked";
+
+// Mirrors jarvis/ultrawiki/service.py::JOB_ACTIVE_STATUSES / JOB_TERMINAL_STATUSES.
+export type UltraWikiJobStatus =
+ | "queued"
+ | "running"
+ | "done"
+ | "failed"
+ | "cancelled";
+
+export const ULTRAWIKI_ACTIVE_JOB_STATUSES: readonly string[] = [
+ "queued",
+ "running",
+];
+
+// Mirrors jarvis/ultrawiki/connectors/__init__.py::builtin_connectors().
+export const ULTRAWIKI_CONNECTOR_IDS = [
+ "obsidian-vault",
+ "local-folder",
+ "jarvis-conversations",
+ "normal-wiki",
+ "plugin-bridge",
+] as const;
+export type UltraWikiConnectorId = (typeof ULTRAWIKI_CONNECTOR_IDS)[number];
+
+export interface UltraWikiCounts {
+ captured: number;
+ keyword_indexed: number;
+ embedded: number;
+ distilled: number;
+ failed: number;
+ total: number;
+}
+
+export interface UltraWikiSource {
+ id: string;
+ connector: string;
+ label: string;
+ consent: UltraWikiConsent | string;
+ enabled: boolean;
+ areas: string[];
+ counts: Partial<UltraWikiCounts> | null;
+ sync_state: Record<string, unknown> | null;
+ last_sync_at: string | null;
+ last_error: string | null;
+}
+
+export interface UltraWikiJob {
+ job_id: string;
+ source_id: string;
+ mode: string;
+ status: UltraWikiJobStatus | string;
+ started_at: number;
+ ended_at: number | null;
+ chunks: number;
+ new: number;
+ changed: number;
+ unchanged: number;
+ tombstoned: number;
+ error: string;
+}
+
+/** One embedding/rerank option row from `GET /api/ultrawiki/providers`. */
+export interface UltraWikiProviderOption {
+ name: string;
+ ready: boolean;
+ reason: string;
+ default_model?: string;
+}
+
+export interface UltraWikiDbBackendOption {
+ name: string;
+ ready: boolean;
+ reason: string;
+ detail: string;
+ secret_present?: boolean;
+}
+
+export interface UltraWikiProviders {
+ embedding: UltraWikiProviderOption[];
+ rerank: UltraWikiProviderOption[];
+ db_backends: UltraWikiDbBackendOption[];
+}
+
+export interface UltraWikiSlotStatus {
+ provider: string;
+ model?: string;
+ ready: boolean;
+ reason: string;
+ available?: UltraWikiProviderOption[];
+ chain?: string[];
+}
+
+export interface UltraWikiStorageSlot {
+ configured: string;
+ in_use: string;
+ ready: boolean;
+ reason: string;
+ vector?: { ready?: boolean; reason?: string };
+}
+
+export interface UltraWikiSearchLeg {
+ available: boolean;
+ backend?: string;
+ model?: string;
+ provider?: string;
+ reason?: string;
+}
+
+export interface UltraWikiStatus {
+ enabled: boolean;
+ started: boolean;
+ db_backend: string;
+ backend_in_use: string;
+ slots: {
+ embedding?: UltraWikiSlotStatus;
+ distill?: UltraWikiSlotStatus;
+ rerank?: UltraWikiSlotStatus;
+ storage?: UltraWikiStorageSlot;
+ };
+ counts: Partial<UltraWikiCounts>;
+ pipeline: { running: boolean; processed: Record<string, number> };
+ sources: UltraWikiSource[];
+ jobs: UltraWikiJob[];
+ search_legs: {
+ keyword?: UltraWikiSearchLeg;
+ vector?: UltraWikiSearchLeg;
+ rerank?: UltraWikiSearchLeg;
+ error?: string;
+ };
+ degradations: string[];
+}
+
+/** Mirrors jarvis/ultrawiki/types.py::SearchResult (dataclasses.asdict). */
+export interface UltraWikiSearchHit {
+ item_id: number;
+ source_id: string;
+ title: string;
+ snippet: string;
+ permalink: string;
+ timestamp_utc: string;
+ score: number;
+ matched_by: string[];
+}
+
+export interface UltraWikiSearchResponse {
+ query: string;
+ results: UltraWikiSearchHit[];
+ total: number;
+}
+
+export interface UltraWikiActivateBody {
+ db_backend?: string;
+ embedding_provider: string;
+ embedding_model?: string;
+ distill_provider?: string;
+ distill_model?: string;
+ rerank_provider?: string;
+ areas?: string[];
+}
+
+export interface UltraWikiActivateResponse {
+ ok: boolean;
+ enabled: boolean;
+ persisted: boolean;
+ next_steps: string;
+ persist_error?: string;
+ default_area?: string;
+ sources_created?: string[];
+ sources_existing?: string[];
+}
+
+export interface UltraWikiDeactivateResponse {
+ ok: boolean;
+ enabled: boolean;
+ persisted: boolean;
+ non_destructive: boolean;
+ detail: string;
+ persist_error?: string;
+}
+
+export interface UltraWikiSettingsBody {
+ db_backend?: string;
+ embedding_provider?: string;
+ embedding_model?: string;
+ distill_provider?: string;
+ distill_model?: string;
+ rerank_provider?: string;
+ confirm_reembed?: boolean;
+}
+
+export interface UltraWikiSettingsResponse {
+ ok: boolean;
+ changed: string[];
+ persisted: boolean;
+ reembed_started: boolean;
+ persist_error?: string;
+}
+
+export interface UltraWikiSlotTestResult {
+ ok: boolean;
+ detail: string;
+ latency_ms: number;
+}
+
+export interface UltraWikiBridgeCandidate {
+ id: string;
+ kind: "plugin" | "mcp" | string;
+ label: string;
+ detail: string;
+}
+
+export interface UltraWikiArea {
+ id: string;
+ name: string;
+}
+
+/** Error carrying the backend's honest `detail` payload (string or object). */
+export class UltraWikiApiError extends Error {
+ readonly status: number;
+ readonly detail: unknown;
+
+ constructor(message: string, status: number, detail: unknown) {
+ super(message);
+ this.name = "UltraWikiApiError";
+ this.status = status;
+ this.detail = detail;
+ }
+}
+
+/** The 409 payload of a guarded embedding change (PUT /settings). */
+export function reembedGateOf(
+ error: unknown,
+): { message: string; vector_items: number } | null {
+ if (!(error instanceof UltraWikiApiError) || error.status !== 409) return null;
+ const detail = error.detail;
+ if (
+ detail &&
+ typeof detail === "object" &&
+ "vector_items" in detail &&
+ typeof (detail as { vector_items: unknown }).vector_items === "number"
+ ) {
+ return {
+ message: String((detail as { message?: unknown }).message ?? ""),
+ vector_items: (detail as { vector_items: number }).vector_items,
+ };
+ }
+ return null;
+}
+
+async function request<T>(url: string, init?: RequestInit): Promise<T> {
+ const res = await fetch(url, init);
+ let body: unknown = null;
+ try {
+ body = await res.json();
+ } catch {
+ // A non-JSON body (proxy error page) falls through to the status error.
+ }
+ if (!res.ok) {
+ const detail = (body as { detail?: unknown } | null)?.detail;
+ const message =
+ typeof detail === "string"
+ ? detail
+ : detail &&
+ typeof detail === "object" &&
+ typeof (detail as { message?: unknown }).message === "string"
+ ? (detail as { message: string }).message
+ : `HTTP ${res.status} ${res.statusText}`;
+ throw new UltraWikiApiError(message, res.status, detail);
+ }
+ return body as T;
+}
+
+function postJson<T>(url: string, payload?: unknown): Promise<T> {
+ return request<T>(url, {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: payload === undefined ? undefined : JSON.stringify(payload),
+ });
+}
+
+/**
+ * Poll-safe status fetch: swallows HTTP and network failures and returns
+ * `null` ("unknown") instead of throwing — the mode toggle and the Ultra
+ * panel treat `null` as "backend unreachable" and stay honest about it.
+ */
+export async function fetchUltraWikiStatus(): Promise<UltraWikiStatus | null> {
+ try {
+ const res = await fetch("/api/ultrawiki/status");
+ if (!res.ok) return null;
+ return (await res.json()) as UltraWikiStatus;
+ } catch {
+ return null;
+ }
+}
+
+export function fetchUltraWikiProviders(): Promise<UltraWikiProviders> {
+ return request<UltraWikiProviders>("/api/ultrawiki/providers");
+}
+
+export function activateUltraWiki(
+ body: UltraWikiActivateBody,
+): Promise<UltraWikiActivateResponse> {
+ return postJson<UltraWikiActivateResponse>("/api/ultrawiki/activate", body);
+}
+
+export function deactivateUltraWiki(): Promise<UltraWikiDeactivateResponse> {
+ return postJson<UltraWikiDeactivateResponse>("/api/ultrawiki/deactivate");
+}
+
+export function updateUltraWikiSettings(
+ body: UltraWikiSettingsBody,
+): Promise<UltraWikiSettingsResponse> {
+ return request<UltraWikiSettingsResponse>("/api/ultrawiki/settings", {
+ method: "PUT",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify(body),
+ });
+}
+
+export function testUltraWikiSlot(
+ slot: "embedding" | "distill" | "rerank" | "storage",
+): Promise<UltraWikiSlotTestResult> {
+ return postJson<UltraWikiSlotTestResult>(
+ `/api/ultrawiki/test/${encodeURIComponent(slot)}`,
+ );
+}
+
+export function createUltraWikiSource(body: {
+ connector: string;
+ label: string;
+ config?: Record<string, unknown>;
+ areas?: string[];
+}): Promise<UltraWikiSource> {
+ return postJson<UltraWikiSource>("/api/ultrawiki/sources", body);
+}
+
+export function approveUltraWikiSource(
+ sourceId: string,
+): Promise<UltraWikiSource> {
+ return postJson<UltraWikiSource>(
+ `/api/ultrawiki/sources/${encodeURIComponent(sourceId)}/approve`,
+ );
+}
+
+export function revokeUltraWikiSource(
+ sourceId: string,
+): Promise<UltraWikiSource> {
+ return postJson<UltraWikiSource>(
+ `/api/ultrawiki/sources/${encodeURIComponent(sourceId)}/revoke`,
+ );
+}
+
+export function startUltraWikiSync(
+ sourceId: string,
+): Promise<{ job_id: string; status: string; source_id: string }> {
+ return postJson<{ job_id: string; status: string; source_id: string }>(
+ `/api/ultrawiki/sources/${encodeURIComponent(sourceId)}/sync`,
+ );
+}
+
+export function cancelUltraWikiJob(
+ jobId: string,
+): Promise<{ job_id: string; cancel_requested: boolean }> {
+ return postJson<{ job_id: string; cancel_requested: boolean }>(
+ `/api/ultrawiki/jobs/${encodeURIComponent(jobId)}/cancel`,
+ );
+}
+
+export function fetchUltraWikiBridgeCandidates(): Promise<{
+ candidates: UltraWikiBridgeCandidate[];
+ total: number;
+}> {
+ return request<{ candidates: UltraWikiBridgeCandidate[]; total: number }>(
+ "/api/ultrawiki/bridge/candidates",
+ );
+}
+
+export function fetchUltraWikiAreas(): Promise<{
+ areas: UltraWikiArea[];
+ total: number;
+}> {
+ return request<{ areas: UltraWikiArea[]; total: number }>(
+ "/api/ultrawiki/areas",
+ );
+}
+
+export function searchUltraWiki(
+ query: string,
+ k = 20,
+): Promise<UltraWikiSearchResponse> {
+ const params = new URLSearchParams({ q: query, k: String(k) });
+ return request<UltraWikiSearchResponse>(
+ `/api/ultrawiki/search?${params.toString()}`,
+ );
+}
+
+/** True when any sync job is still queued or running (drives poll cadence). */
+export function hasActiveUltraWikiJobs(
+ jobs: UltraWikiJob[] | undefined | null,
+): boolean {
+ return (jobs ?? []).some((job) =>
+ ULTRAWIKI_ACTIVE_JOB_STATUSES.includes(job.status),
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/views/WikiView.tsx b/jarvis/ui/web/frontend/src/views/WikiView.tsx
index 1fe3388f96..913a9bc936 100644
--- a/jarvis/ui/web/frontend/src/views/WikiView.tsx
+++ b/jarvis/ui/web/frontend/src/views/WikiView.tsx
@@ -42,6 +42,8 @@ import { PageRenderer } from "@/components/wiki/PageRenderer";
import { BacklinksPanel } from "@/components/wiki/BacklinksPanel";
import { ObsidianStatus } from "@/components/wiki/ObsidianStatus";
import { ObsidianSetupDialog } from "@/components/wiki/ObsidianSetupDialog";
+import { UltraModeSwitch } from "@/components/ultrawiki/UltraModeSwitch";
+import { fetchUltraWikiStatus } from "@/lib/ultrawikiApi";
import type { ObsidianStatus as ObsidianStatusType } from "@/types/setup";
// Agent C owns WikiGraph. Lazy import so the graph bundle (~120 KB minified)
@@ -53,6 +55,14 @@ const WikiGraph = lazy(() =>
})),
);
+// Ultra-mode body (decision D-5: either-or). Lazy like WikiGraph so
+// normal-mode users never download the Ultra chunk.
+const UltraWikiPanel = lazy(() =>
+ import("@/views/ultrawiki/UltraWikiPanel").then((mod) => ({
+ default: mod.UltraWikiPanel,
+ })),
+);
+
type CentreTab = "graph" | "page";
interface WikiToast {
@@ -95,6 +105,16 @@ export function WikiView(): JSX.Element {
staleTime: 5_000,
});
+ // UltraWiki mode (D-5): `GET /api/ultrawiki/status` → `enabled` is the one
+ // source of truth for which body this section renders. `null` = backend
+ // unreachable → the normal wiki stands.
+ const ultraStatusQuery = useQuery({
+ queryKey: ["ultrawiki", "status"],
+ queryFn: fetchUltraWikiStatus,
+ staleTime: 5_000,
+ });
+ const ultraEnabled = ultraStatusQuery.data?.enabled === true;
+
// When a slug is selected (via tree click, graph click, or wikilink),
// automatically swap to the page tab.
useEffect(() => {
@@ -202,7 +222,11 @@ export function WikiView(): JSX.Element {
subtitle={subtitle}
/>
</div>
- <div className="flex shrink-0 items-center pt-4">
+ <div className="flex shrink-0 items-center gap-3 pt-4">
+ <UltraModeSwitch
+ status={ultraStatusQuery.data ?? null}
+ onModeChanged={() => void ultraStatusQuery.refetch()}
+ />
<ObsidianStatus
onOpenSetup={(s) => {
setSetupHint(s);
@@ -212,6 +236,14 @@ export function WikiView(): JSX.Element {
</div>
</div>
+ {ultraEnabled ? (
+ // Ultra mode owns the entire body below the header (D-5 either-or);
+ // the normal wiki surfaces stay untouched, ready for the switch back.
+ <Suspense fallback={<GraphSkeleton />}>
+ <UltraWikiPanel />
+ </Suspense>
+ ) : (
+ <>
<WikiHealthStrip
health={healthQuery.data}
isLoading={healthQuery.isLoading}
@@ -372,6 +404,8 @@ export function WikiView(): JSX.Element {
))}
</div>
)}
+ </>
+ )}
{toast && (
<div
diff --git a/jarvis/ui/web/frontend/src/views/WikiView.ultrawiki-toggle.test.tsx b/jarvis/ui/web/frontend/src/views/WikiView.ultrawiki-toggle.test.tsx
new file mode 100644
index 0000000000..75b6036405
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/views/WikiView.ultrawiki-toggle.test.tsx
@@ -0,0 +1,148 @@
+/**
+ * WikiView Ultra-mode toggle tests (decision D-5, either-or).
+ *
+ * Pins that the Normal | Ultra segmented toggle renders at the top of the
+ * Wiki section and that `GET /api/ultrawiki/status` → `enabled` is the one
+ * source of truth for which body is mounted: normal wiki content vs the
+ * (lazy) UltraWikiPanel. The panel itself is stubbed — its behavior has its
+ * own colocated tests.
+ */
+import { afterEach, describe, expect, it, vi } from "vitest";
+import { cleanup, render, screen, waitFor } from "@testing-library/react";
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+
+import { WikiView } from "@/views/WikiView";
+import type { WikiTreeResponse } from "@/lib/wikiApi";
+import type { UltraWikiStatus } from "@/lib/ultrawikiApi";
+
+vi.mock("@/hooks/useWikiLive", () => ({
+ useWikiLive: () => ({ connected: true, lastEventAt: null }),
+}));
+
+// The Ultra panel is lazy-loaded by WikiView; stub it so this test pins the
+// mode switch alone (the panel has its own tests).
+vi.mock("@/views/ultrawiki/UltraWikiPanel", () => ({
+ UltraWikiPanel: () => <div data-testid="ultrawiki-panel-stub" />,
+}));
+
+function renderWithClient(node: React.ReactNode) {
+ const client = new QueryClient({
+ defaultOptions: { queries: { retry: false, gcTime: 0, staleTime: 0 } },
+ });
+ return render(
+ <QueryClientProvider client={client}>{node}</QueryClientProvider>,
+ );
+}
+
+const EMPTY_TREE: WikiTreeResponse = {
+ ok: true,
+ vault_root: "wiki/obsidian-vault",
+ folders: [],
+ stats: { total_pages: 0, total_links: 0, last_curator_run: null },
+};
+
+function ultraStatus(enabled: boolean): UltraWikiStatus {
+ return {
+ enabled,
+ started: enabled,
+ db_backend: "sqlite",
+ backend_in_use: enabled ? "sqlite" : "",
+ slots: {},
+ counts: {},
+ pipeline: { running: false, processed: {} },
+ sources: [],
+ jobs: [],
+ search_legs: { keyword: { available: true } },
+ degradations: [],
+ };
+}
+
+function installFetchMock(routes: Record<string, () => unknown>) {
+ const fetchMock = vi.fn(async (input: RequestInfo | URL) => {
+ const url = String(input);
+ const prefixes = Object.keys(routes).sort((a, b) => b.length - a.length);
+ for (const prefix of prefixes) {
+ if (url.startsWith(prefix)) {
+ return {
+ ok: true,
+ status: 200,
+ statusText: "OK",
+ json: async () => routes[prefix](),
+ } as Response;
+ }
+ }
+ throw new Error(`unexpected fetch ${url}`);
+ });
+ (globalThis as unknown as { fetch: typeof fetch }).fetch =
+ fetchMock as unknown as typeof fetch;
+ return fetchMock;
+}
+
+function baseRoutes(enabled: boolean): Record<string, () => unknown> {
+ return {
+ "/api/wiki/tree": () => EMPTY_TREE,
+ "/api/wiki/health": () => ({ ok: false }),
+ "/api/ultrawiki/status": () => ultraStatus(enabled),
+ "/api/setup/obsidian/status": () => ({
+ installed: true,
+ config_exists: true,
+ vault_registered: true,
+ recommended_action: "ok",
+ }),
+ "/api/setup/state": () => ({ obsidian_setup_seen: true }),
+ };
+}
+
+afterEach(() => {
+ cleanup();
+ vi.restoreAllMocks();
+});
+
+describe("WikiView — Ultra mode toggle", () => {
+ it("renders the Normal|Ultra toggle and the normal wiki body while disabled", async () => {
+ installFetchMock(baseRoutes(false));
+ renderWithClient(<WikiView />);
+
+ await waitFor(() => {
+ expect(screen.getByTestId("wiki-mode-toggle")).toBeDefined();
+ });
+ await waitFor(() => {
+ expect(
+ screen.getByTestId("wiki-mode-toggle").getAttribute("data-mode"),
+ ).toBe("normal");
+ });
+
+ // Normal body mounted, Ultra panel absent.
+ await waitFor(() => {
+ expect(screen.getByTestId("wiki-empty-state")).toBeDefined();
+ });
+ expect(screen.queryByTestId("ultrawiki-panel-stub")).toBeNull();
+
+ const normalButton = screen.getByTestId("wiki-mode-normal");
+ const ultraButton = screen.getByTestId("wiki-mode-ultra");
+ expect(normalButton.getAttribute("aria-pressed")).toBe("true");
+ expect(ultraButton.getAttribute("aria-pressed")).toBe("false");
+ });
+
+ it("mounts the Ultra panel INSTEAD of the normal wiki body when status.enabled is true", async () => {
+ installFetchMock(baseRoutes(true));
+ renderWithClient(<WikiView />);
+
+ await waitFor(() => {
+ expect(
+ screen.getByTestId("wiki-mode-toggle").getAttribute("data-mode"),
+ ).toBe("ultra");
+ });
+
+ // The lazy chunk resolves and replaces the normal body entirely (D-5).
+ await waitFor(() => {
+ expect(screen.getByTestId("ultrawiki-panel-stub")).toBeDefined();
+ });
+ expect(screen.queryByTestId("wiki-empty-state")).toBeNull();
+ expect(screen.queryByTestId("wiki-health-strip")).toBeNull();
+
+ expect(
+ screen.getByTestId("wiki-mode-ultra").getAttribute("aria-pressed"),
+ ).toBe("true");
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/views/ultrawiki/UltraWikiPanel.tsx b/jarvis/ui/web/frontend/src/views/ultrawiki/UltraWikiPanel.tsx
new file mode 100644
index 0000000000..8069c481e7
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/views/ultrawiki/UltraWikiPanel.tsx
@@ -0,0 +1,185 @@
+/**
+ * Ultra-mode body of the Wiki section (design doc 04) — rendered by WikiView
+ * INSTEAD of the normal wiki workspace while UltraWiki mode is on (D-5).
+ *
+ * Lazy-loaded from WikiView (the WikiGraph pattern) so normal-mode users
+ * never pay for this chunk. Owns the Ultra status poll: every 30 s at rest,
+ * every 4 s while a sync job is active (the wiki health polling idiom).
+ *
+ * Layout: honest degradation banner → staged import-progress strip → the
+ * three tabs Ask | Sources | Settings. A dead required slot banners the
+ * problem and links to the settings tab — the mode is never flipped silently
+ * (design doc 04, mode-switch rules).
+ */
+import { useState } from "react";
+import { AlertTriangle, MessageCircleQuestion, Plug, Settings2 } from "lucide-react";
+import { useQuery } from "@tanstack/react-query";
+
+import { cn } from "@/lib/utils";
+import { useT } from "@/i18n";
+import {
+ fetchUltraWikiStatus,
+ hasActiveUltraWikiJobs,
+} from "@/lib/ultrawikiApi";
+import { AskPanel } from "@/components/ultrawiki/AskPanel";
+import { SourcesPanel } from "@/components/ultrawiki/SourcesPanel";
+import { SlotsPanel } from "@/components/ultrawiki/SlotsPanel";
+import { ImportProgress } from "@/components/ultrawiki/ImportProgress";
+
+type UltraTab = "ask" | "sources" | "settings";
+
+export function UltraWikiPanel(): JSX.Element {
+ const t = useT();
+ const [tab, setTab] = useState<UltraTab>("ask");
+
+ const statusQuery = useQuery({
+ queryKey: ["ultrawiki", "status"],
+ queryFn: fetchUltraWikiStatus,
+ staleTime: 2_000,
+ // Poll every few seconds while a sync job runs, calmly otherwise.
+ refetchInterval: (query) =>
+ hasActiveUltraWikiJobs(query.state.data?.jobs) ? 4_000 : 30_000,
+ });
+
+ const status = statusQuery.data ?? null;
+ const refetch = () => void statusQuery.refetch();
+
+ if (statusQuery.isLoading) {
+ return (
+ <div
+ className="flex flex-1 items-center justify-center p-6 text-sm text-muted-foreground"
+ data-testid="ultrawiki-panel-loading"
+ >
+ {t("ultrawiki.panel.loading")}
+ </div>
+ );
+ }
+
+ if (!status) {
+ return (
+ <div className="flex flex-1 items-center justify-center p-6">
+ <div
+ role="alert"
+ className="max-w-md rounded-md border border-destructive/40 bg-destructive/10 px-4 py-3 text-sm text-destructive"
+ data-testid="ultrawiki-panel-unavailable"
+ >
+ {t("ultrawiki.panel.status_unavailable")}
+ </div>
+ </div>
+ );
+ }
+
+ const embedding = status.slots.embedding;
+ const embeddingDead = Boolean(embedding && !embedding.ready);
+
+ return (
+ <div
+ className="flex flex-1 min-h-0 flex-col"
+ data-testid="ultrawiki-panel"
+ >
+ {(status.degradations.length > 0 || embeddingDead) && (
+ <div
+ className="space-y-1 border-b border-border bg-[#ffb84d]/10 px-4 py-2 text-xs text-[#ffb84d]"
+ data-testid="ultrawiki-degradations"
+ >
+ {embeddingDead && (
+ <p className="flex flex-wrap items-center gap-1.5">
+ <AlertTriangle className="h-3.5 w-3.5 shrink-0" aria-hidden />
+ {t("ultrawiki.panel.embedding_dead").replace(
+ "{0}",
+ embedding?.reason ?? "",
+ )}
+ <button
+ type="button"
+ onClick={() => setTab("settings")}
+ className="underline underline-offset-2 hover:text-foreground"
+ data-testid="ultrawiki-open-settings-link"
+ >
+ {t("ultrawiki.panel.open_settings")}
+ </button>
+ </p>
+ )}
+ {status.degradations.map((line) => (
+ <p key={line} className="flex items-center gap-1.5">
+ <AlertTriangle className="h-3.5 w-3.5 shrink-0" aria-hidden />
+ {line}
+ </p>
+ ))}
+ </div>
+ )}
+
+ <ImportProgress
+ counts={status.counts}
+ pipelineRunning={status.pipeline.running}
+ jobs={status.jobs}
+ onChanged={refetch}
+ />
+
+ <div className="flex items-stretch border-b border-border bg-card/40">
+ <UltraTabButton
+ active={tab === "ask"}
+ onClick={() => setTab("ask")}
+ icon={<MessageCircleQuestion className="h-3.5 w-3.5" aria-hidden />}
+ label={t("ultrawiki.panel.tab_ask")}
+ testId="ultrawiki-tab-ask"
+ />
+ <UltraTabButton
+ active={tab === "sources"}
+ onClick={() => setTab("sources")}
+ icon={<Plug className="h-3.5 w-3.5" aria-hidden />}
+ label={t("ultrawiki.panel.tab_sources")}
+ testId="ultrawiki-tab-sources"
+ />
+ <UltraTabButton
+ active={tab === "settings"}
+ onClick={() => setTab("settings")}
+ icon={<Settings2 className="h-3.5 w-3.5" aria-hidden />}
+ label={t("ultrawiki.panel.tab_settings")}
+ testId="ultrawiki-tab-settings"
+ />
+ </div>
+
+ <div className="min-h-0 flex-1 overflow-y-auto">
+ {tab === "ask" && <AskPanel searchLegs={status.search_legs} />}
+ {tab === "sources" && (
+ <SourcesPanel sources={status.sources} onChanged={refetch} />
+ )}
+ {tab === "settings" && (
+ <SlotsPanel status={status} onChanged={refetch} />
+ )}
+ </div>
+ </div>
+ );
+}
+
+function UltraTabButton({
+ active,
+ onClick,
+ icon,
+ label,
+ testId,
+}: {
+ active: boolean;
+ onClick: () => void;
+ icon: React.ReactNode;
+ label: string;
+ testId: string;
+}): JSX.Element {
+ return (
+ <button
+ type="button"
+ onClick={onClick}
+ className={cn(
+ "flex items-center gap-1.5 border-b-2 px-4 py-2.5 text-xs transition-colors",
+ active
+ ? "border-primary text-foreground"
+ : "border-transparent text-muted-foreground hover:text-foreground",
+ )}
+ data-active={active ? "true" : "false"}
+ data-testid={testId}
+ >
+ {icon}
+ {label}
+ </button>
+ );
+}