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): curated connector catalog — real names, bundled logos, roster-only picker

Ruben Lütke4ac49da9b560
diff --git a/jarvis/ui/web/frontend/src/components/ultrawiki/ConnectorBrand.tsx b/jarvis/ui/web/frontend/src/components/ultrawiki/ConnectorBrand.tsx
new file mode 100644
index 0000000000..1c28ad70a8
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/ultrawiki/ConnectorBrand.tsx
@@ -0,0 +1,125 @@
+/**
+ * Brand marks for UltraWiki connectors.
+ *
+ * The Plugins store's resolution, reused rather than reinvented: the SAME
+ * bundled SVGs under `src/assets/brands`, keyed by the same id, so a mark added
+ * for the store shows up here for free and a card can never disagree with the
+ * store about what a service looks like.
+ *
+ * Two tiers, not three. The store falls back to a Simple Icons glyph fetched
+ * from a CDN; a knowledge base must render on a locked-down network and on a
+ * headless host, so this component goes straight from "bundled mark" to
+ * "monogram" and never reaches for a third party at render time. A monogram is
+ * therefore a visible signal that a mark is missing from the ledger — which is
+ * the point: it should look like something to fix, not like a design.
+ *
+ * Built-in connectors have no vendor and must not borrow one. Their brand token
+ * is one of the neutral names (`vault`, `folder`, `chat`, `wiki`) and resolves
+ * to one of our own icons.
+ */
+import { useState } from "react";
+import { BookOpen, FolderOpen, MessageSquare, Vault } from "lucide-react";
+import type { LucideIcon } from "lucide-react";
+
+import { cn } from "@/lib/utils";
+
+const BUNDLED_BRAND_LOGOS = import.meta.glob("../../assets/brands/*.svg", {
+ eager: true,
+ query: "?url",
+ import: "default",
+}) as Record<string, string>;
+
+/** The bundled mark for a brand key, or undefined when none is bundled. */
+export function brandAssetUrl(brand: string): string | undefined {
+ const key = (brand ?? "").trim();
+ if (!key) return undefined;
+ return BUNDLED_BRAND_LOGOS[`../../assets/brands/${key}.svg`];
+}
+
+const NEUTRAL_ICONS: Record<string, LucideIcon | undefined> = {
+ vault: Vault,
+ folder: FolderOpen,
+ chat: MessageSquare,
+ wiki: BookOpen,
+};
+
+/** Which tier a mark resolved to — also exposed as `data-brand-tier`, so a
+ * test can assert the fallback rather than guess at rendered pixels. */
+export type BrandTier = "asset" | "neutral" | "monogram";
+
+export function brandTierOf(brand: string): BrandTier {
+ if (brandAssetUrl(brand)) return "asset";
+ if (NEUTRAL_ICONS[(brand ?? "").trim()]) return "neutral";
+ return "monogram";
+}
+
+const SIZES = {
+ sm: { box: "h-8 w-8", mark: "h-5 w-5", text: "text-[11px]" },
+ md: { box: "h-10 w-10", mark: "h-6 w-6", text: "text-sm" },
+} as const;
+
+export function ConnectorBrandMark({
+ brand,
+ label,
+ size = "md",
+ className,
+ testId,
+}: {
+ brand: string;
+ /** Only used for the monogram and the accessible name. */
+ label: string;
+ size?: keyof typeof SIZES;
+ className?: string;
+ testId?: string;
+}): JSX.Element {
+ const [failed, setFailed] = useState(false);
+ const dims = SIZES[size];
+ const asset = brandAssetUrl(brand);
+ const NeutralIcon = NEUTRAL_ICONS[(brand ?? "").trim()];
+ const tier: BrandTier = failed
+ ? "monogram"
+ : asset
+ ? "asset"
+ : NeutralIcon
+ ? "neutral"
+ : "monogram";
+
+ return (
+ <div
+ className={cn(
+ "grid shrink-0 place-items-center overflow-hidden rounded-lg border",
+ dims.box,
+ // A full-colour vendor mark sits on a light plate (its own colours
+ // carry the brand); our neutral icons and monograms sit on the card's
+ // own surface, so a built-in never masquerades as a vendor tile.
+ tier === "asset"
+ ? "border-white/10 bg-white/[0.07]"
+ : "border-border/60 bg-secondary/40",
+ className,
+ )}
+ data-testid={testId}
+ data-brand={brand || "none"}
+ data-brand-tier={tier}
+ title={label}
+ >
+ {tier === "asset" && asset ? (
+ <img
+ src={asset}
+ alt=""
+ className={dims.mark}
+ loading="lazy"
+ onError={() => setFailed(true)}
+ />
+ ) : tier === "neutral" && NeutralIcon ? (
+ <NeutralIcon
+ className={cn(dims.mark, "text-muted-foreground")}
+ aria-hidden
+ />
+ ) : (
+ <span className={cn("font-semibold text-foreground", dims.text)}>
+ {(label || "?").slice(0, 1).toUpperCase()}
+ </span>
+ )}
+ </div>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/components/ultrawiki/ConnectorPicker.test.tsx b/jarvis/ui/web/frontend/src/components/ultrawiki/ConnectorPicker.test.tsx
new file mode 100644
index 0000000000..90893df101
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/ultrawiki/ConnectorPicker.test.tsx
@@ -0,0 +1,275 @@
+/**
+ * ConnectorPicker tests — the picker is a CATALOG, not a registry viewer.
+ *
+ * Pins the four properties the roster exists to guarantee: only curated entries
+ * render (a connected tool the roster does not name stays invisible), each tile
+ * carries a real brand mark with a monogram fallback rather than a broken
+ * image, a curated integration that is not connected is shown but refuses to be
+ * added, and the honest status badge is never silently upgraded.
+ */
+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 { ConnectorPicker } from "@/components/ultrawiki/ConnectorPicker";
+
+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 ROSTER = {
+ connectors: [
+ {
+ id: "local-folder",
+ kind: "builtin",
+ label: "Local folder",
+ label_key: "ultrawiki.sources.connector_local_folder",
+ brand: "folder",
+ status: "available",
+ description_key: "ultrawiki.connectors.local_folder",
+ connector: "local-folder",
+ integration_id: "",
+ },
+ {
+ id: "github",
+ kind: "bridge",
+ label: "GitHub",
+ label_key: "",
+ brand: "github",
+ status: "adapter_pending",
+ description_key: "ultrawiki.connectors.github",
+ connector: "plugin-bridge",
+ integration_id: "plugin:github",
+ },
+ {
+ id: "notion",
+ kind: "bridge",
+ label: "Notion",
+ label_key: "",
+ brand: "notion",
+ status: "adapter_pending",
+ description_key: "ultrawiki.connectors.notion",
+ connector: "plugin-bridge",
+ integration_id: "plugin:notion",
+ },
+ // A curated entry whose brand mark is NOT bundled — the monogram path.
+ {
+ id: "acme_notes",
+ kind: "bridge",
+ label: "Acme Notes",
+ label_key: "",
+ brand: "acme_notes",
+ status: "adapter_pending",
+ description_key: "ultrawiki.connectors.acme_notes",
+ connector: "plugin-bridge",
+ integration_id: "plugin:acme_notes",
+ },
+ ],
+ total: 4,
+ builtin: 1,
+ bridge: 3,
+};
+
+function candidate(overrides: Record<string, unknown>) {
+ return {
+ id: "plugin:github",
+ kind: "plugin",
+ label: "GitHub",
+ detail: "connected marketplace plugin; pull adapter pending",
+ catalog_id: "github",
+ brand: "github",
+ connector_kind: "bridge",
+ description_key: "ultrawiki.connectors.github",
+ status: "adapter_pending",
+ connected: true,
+ has_pull_adapter: false,
+ ...overrides,
+ };
+}
+
+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 mountPicker(
+ candidates: unknown[],
+ onSelect = vi.fn(),
+ selectedKey = "",
+) {
+ installFetchMock({
+ "/api/ultrawiki/connectors": () => ROSTER,
+ "/api/ultrawiki/bridge/candidates": () => ({
+ candidates,
+ total: candidates.length,
+ connected: candidates.filter(
+ (c) => (c as { connected?: boolean }).connected,
+ ).length,
+ }),
+ });
+ renderWithClient(
+ <ConnectorPicker selectedKey={selectedKey} onSelect={onSelect} />,
+ );
+ return onSelect;
+}
+
+afterEach(() => {
+ cleanup();
+ vi.restoreAllMocks();
+});
+
+describe("ConnectorPicker — only the curated roster renders", () => {
+ it("shows roster entries and hides a connected tool the roster does not name", async () => {
+ mountPicker([
+ candidate({}),
+ // Connected, and deliberately absent from the roster: the exact class of
+ // row the old raw-dump picker used to display.
+ candidate({
+ id: "mcp:grace-plug-in",
+ catalog_id: "grace_plug_in",
+ label: "grace plug in mcp",
+ brand: "",
+ }),
+ ]);
+
+ await waitFor(() => {
+ expect(screen.getByTestId("uw-picker-github")).toBeDefined();
+ });
+ expect(screen.getByTestId("uw-picker-local-folder")).toBeDefined();
+ expect(screen.queryByTestId("uw-picker-grace_plug_in")).toBeNull();
+ expect(screen.queryByText("grace plug in mcp")).toBeNull();
+ });
+
+ it("renders every tile with a brand mark, falling back to a monogram", async () => {
+ mountPicker([candidate({})]);
+
+ await waitFor(() => {
+ expect(screen.getByTestId("uw-picker-brand-github")).toBeDefined();
+ });
+ // A bundled vendor mark, our own neutral icon, and the monogram fallback —
+ // never a broken image, never a blank tile.
+ expect(
+ screen.getByTestId("uw-picker-brand-github").getAttribute("data-brand-tier"),
+ ).toBe("asset");
+ expect(
+ screen
+ .getByTestId("uw-picker-brand-local-folder")
+ .getAttribute("data-brand-tier"),
+ ).toBe("neutral");
+ const monogram = screen.getByTestId("uw-picker-brand-acme_notes");
+ expect(monogram.getAttribute("data-brand-tier")).toBe("monogram");
+ expect(monogram.textContent).toBe("A");
+ });
+});
+
+describe("ConnectorPicker — honest status", () => {
+ it("flags a curated integration that is not connected and refuses to add it", async () => {
+ const onSelect = mountPicker([candidate({})]);
+
+ await waitFor(() => {
+ expect(screen.getByTestId("uw-picker-notion")).toBeDefined();
+ });
+ const tile = screen.getByTestId("uw-picker-notion");
+ expect(tile.getAttribute("data-connected")).toBe("false");
+ expect(tile.hasAttribute("disabled")).toBe(true);
+ expect(
+ screen.getByTestId("uw-picker-badge-notion").getAttribute("data-status"),
+ ).toBe("not_connected");
+ // It says where to go instead of leaving a dead tile unexplained.
+ expect(screen.getByTestId("uw-picker-hint-notion").textContent).toContain(
+ "Plugins",
+ );
+
+ fireEvent.click(tile);
+ expect(onSelect).not.toHaveBeenCalled();
+ });
+
+ it("marks a connected integration whose reader is not built yet", async () => {
+ mountPicker([candidate({})]);
+
+ await waitFor(() => {
+ expect(screen.getByTestId("uw-picker-badge-github")).toBeDefined();
+ });
+ expect(
+ screen.getByTestId("uw-picker-badge-github").getAttribute("data-status"),
+ ).toBe("adapter_pending");
+ });
+
+ it("shows a registered reader as ready to import", async () => {
+ mountPicker([candidate({ status: "available", has_pull_adapter: true })]);
+
+ await waitFor(() => {
+ expect(screen.getByTestId("uw-picker-badge-github")).toBeDefined();
+ });
+ expect(
+ screen.getByTestId("uw-picker-badge-github").getAttribute("data-status"),
+ ).toBe("available");
+ });
+
+ it("selects a connected entry with the candidate's own integration id", async () => {
+ const onSelect = mountPicker([
+ // A user's own MCP server for the same product: the source must be wired
+ // to THAT id, not to the roster's default plugin id.
+ candidate({ id: "mcp:github", kind: "mcp" }),
+ ]);
+
+ await waitFor(() => {
+ expect(screen.getByTestId("uw-picker-github")).toBeDefined();
+ });
+ fireEvent.click(screen.getByTestId("uw-picker-github"));
+
+ expect(onSelect).toHaveBeenCalledTimes(1);
+ expect(onSelect.mock.calls[0][0]).toMatchObject({
+ key: "github",
+ connector: "plugin-bridge",
+ integrationId: "mcp:github",
+ label: "GitHub",
+ connected: true,
+ });
+ });
+});
+
+describe("ConnectorPicker — an unanswerable question is not guessed at", () => {
+ it("withholds bridge tiles when the connection check fails", async () => {
+ // No route for the candidates call: the mock rejects it like a dead
+ // backend would.
+ installFetchMock({ "/api/ultrawiki/connectors": () => ROSTER });
+ renderWithClient(<ConnectorPicker selectedKey="" onSelect={vi.fn()} />);
+
+ await waitFor(() => {
+ expect(screen.getByTestId("uw-picker-candidates-failed")).toBeDefined();
+ });
+ // Built-ins are unaffected — the picker stays usable.
+ expect(screen.getByTestId("uw-picker-local-folder")).toBeDefined();
+ // Claiming "not connected" about an app we could not ask would send
+ // someone reconnecting a healthy integration.
+ expect(screen.queryByTestId("uw-picker-github")).toBeNull();
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/components/ultrawiki/ConnectorPicker.tsx b/jarvis/ui/web/frontend/src/components/ultrawiki/ConnectorPicker.tsx
new file mode 100644
index 0000000000..5d7ea70b6d
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/ultrawiki/ConnectorPicker.tsx
@@ -0,0 +1,337 @@
+/**
+ * The add-source picker: a small tile grid of everything UltraWiki OFFERS.
+ *
+ * It used to be a `<select>` of five connector ids plus, for the bridge, a raw
+ * dump of every marketplace plugin and `mcp.json` server the machine had —
+ * rows carrying whatever string the registry held. That is a registry viewer,
+ * not a product surface: it showed things UltraWiki has no reader for, named
+ * them however the registry felt like, and gave a user nothing to recognise.
+ *
+ * Now the backend's curated roster (`GET /api/ultrawiki/connectors`) decides
+ * what renders, and this component only draws it — logo, real product name, one
+ * line of what it holds, and one honest badge. Two calls, two different
+ * questions:
+ *
+ * • the roster says WHAT EXISTS (product data, identical on every install);
+ * • `GET /api/ultrawiki/bridge/candidates` says WHAT THIS MACHINE HAS,
+ * which flips a tile from "not connected" to selectable and can upgrade its
+ * status when a pull adapter is actually registered.
+ *
+ * A curated integration the user has not connected is shown, not hidden: seeing
+ * what is possible is the point of a catalog. It is not selectable either —
+ * adding it would register a source that can never read anything — so the tile
+ * says where to go instead.
+ *
+ * If the connection check fails, bridge tiles are withheld rather than guessed
+ * at: claiming "not connected" about an app we could not ask is the kind of
+ * confident wrong answer that sends someone reconnecting a healthy integration.
+ */
+import { useQuery } from "@tanstack/react-query";
+import { AlertCircle, Check, Loader2 } from "lucide-react";
+
+import { cn } from "@/lib/utils";
+import { useT } from "@/i18n";
+import { ConnectorBrandMark } from "@/components/ultrawiki/ConnectorBrand";
+import {
+ fetchUltraWikiBridgeCandidates,
+ fetchUltraWikiConnectors,
+ type UltraWikiBridgeCandidate,
+ type UltraWikiConnectorSpec,
+} from "@/lib/ultrawikiApi";
+
+/** One tile: a roster entry merged with what this machine actually has. */
+export interface ConnectorOption {
+ /** The roster id — stable across renders, used as the selection key. */
+ key: string;
+ /** The connector a source is registered under. */
+ connector: string;
+ /** Bridge only: the candidate id that goes into the source config. */
+ integrationId: string;
+ kind: string;
+ label: string;
+ labelKey: string;
+ brand: string;
+ descriptionKey: string;
+ status: string;
+ connected: boolean;
+}
+
+/** The name to show: ours translates, a vendor's own spelling never does. */
+export function connectorLabel(
+ option: ConnectorOption,
+ t: (key: string) => string,
+): string {
+ if (option.kind === "builtin" && option.labelKey) return t(option.labelKey);
+ return option.label;
+}
+
+function mergeOptions(
+ roster: UltraWikiConnectorSpec[],
+ candidates: UltraWikiBridgeCandidate[] | null,
+): ConnectorOption[] {
+ const byCatalogId = new Map<string, UltraWikiBridgeCandidate>();
+ for (const candidate of candidates ?? []) {
+ const id = String(candidate.catalog_id ?? "");
+ if (id) byCatalogId.set(id, candidate);
+ }
+ const options: ConnectorOption[] = [];
+ for (const spec of roster) {
+ if (spec.kind === "builtin") {
+ options.push({
+ key: spec.id,
+ connector: spec.connector,
+ integrationId: "",
+ kind: spec.kind,
+ label: spec.label,
+ labelKey: spec.label_key,
+ brand: spec.brand,
+ descriptionKey: spec.description_key,
+ status: String(spec.status),
+ connected: true,
+ });
+ continue;
+ }
+ // Bridge tiles need the machine's answer. Without it we know nothing about
+ // this integration, so it is withheld rather than shown as disconnected.
+ if (candidates === null) continue;
+ const found = byCatalogId.get(spec.id);
+ options.push({
+ key: spec.id,
+ connector: spec.connector,
+ // The candidate's own id wins: a user's MCP server for the same product
+ // arrives as `mcp:<name>`, and that is what the source must be wired to.
+ integrationId: String(found?.id ?? spec.integration_id),
+ kind: spec.kind,
+ label: String(found?.label || spec.label),
+ labelKey: "",
+ brand: String(found?.brand || spec.brand),
+ descriptionKey: String(found?.description_key || spec.description_key),
+ status: String(found?.status ?? spec.status),
+ connected: Boolean(found?.connected),
+ });
+ }
+ return options;
+}
+
+function StatusBadge({ option }: { option: ConnectorOption }): JSX.Element {
+ const t = useT();
+ const notConnected = !option.connected;
+ const pending = option.status === "adapter_pending";
+ const labelKey = notConnected
+ ? "ultrawiki.picker.badge_not_connected"
+ : pending
+ ? "ultrawiki.picker.badge_adapter_pending"
+ : "ultrawiki.picker.badge_available";
+ return (
+ <span
+ data-testid={`uw-picker-badge-${option.key}`}
+ data-status={notConnected ? "not_connected" : option.status}
+ className={cn(
+ "inline-block rounded-full border px-1.5 py-0.5 text-[9px] leading-tight",
+ notConnected
+ ? "border-border/70 bg-muted/40 text-muted-foreground"
+ : pending
+ ? "border-[#ffb84d]/40 bg-[#ffb84d]/10 text-[#ffb84d]"
+ : "border-[#5bd4a4]/40 bg-[#5bd4a4]/10 text-[#5bd4a4]",
+ )}
+ >
+ {t(labelKey)}
+ </span>
+ );
+}
+
+function ConnectorTile({
+ option,
+ selected,
+ onSelect,
+}: {
+ option: ConnectorOption;
+ selected: boolean;
+ onSelect: () => void;
+}): JSX.Element {
+ const t = useT();
+ const selectable = option.connected;
+ return (
+ <button
+ type="button"
+ onClick={selectable ? onSelect : undefined}
+ disabled={!selectable}
+ aria-pressed={selected}
+ data-testid={`uw-picker-${option.key}`}
+ data-connected={option.connected ? "true" : "false"}
+ className={cn(
+ "flex w-full items-start gap-2.5 rounded-xl border p-2.5 text-left transition-colors",
+ selected
+ ? "border-primary/60 bg-primary/5 ring-1 ring-primary/40"
+ : "border-border bg-card/40",
+ selectable ? "hover:bg-secondary/30" : "cursor-not-allowed opacity-60",
+ )}
+ >
+ <ConnectorBrandMark
+ brand={option.brand}
+ label={connectorLabel(option, t)}
+ size="md"
+ testId={`uw-picker-brand-${option.key}`}
+ />
+ <span className="min-w-0 flex-1">
+ <span className="flex items-center gap-1.5">
+ <span className="truncate text-xs font-medium text-foreground">
+ {connectorLabel(option, t)}
+ </span>
+ {selected && (
+ <Check className="h-3 w-3 shrink-0 text-primary" aria-hidden />
+ )}
+ </span>
+ <span className="mt-0.5 block text-[11px] leading-snug text-muted-foreground">
+ {t(option.descriptionKey)}
+ </span>
+ <span className="mt-1 flex flex-wrap items-center gap-1.5">
+ <StatusBadge option={option} />
+ </span>
+ {!option.connected && (
+ <span
+ className="mt-1 block text-[10px] leading-snug text-muted-foreground"
+ data-testid={`uw-picker-hint-${option.key}`}
+ >
+ {t("ultrawiki.picker.not_connected_hint")}
+ </span>
+ )}
+ {option.connected && option.status === "adapter_pending" && selected && (
+ <span className="mt-1 block text-[10px] leading-snug text-[#ffb84d]">
+ {t("ultrawiki.picker.adapter_pending_hint")}
+ </span>
+ )}
+ </span>
+ </button>
+ );
+}
+
+function Group({
+ titleKey,
+ hintKey,
+ options,
+ selectedKey,
+ onSelect,
+ testId,
+}: {
+ titleKey: string;
+ hintKey: string;
+ options: ConnectorOption[];
+ selectedKey: string;
+ onSelect: (option: ConnectorOption) => void;
+ testId: string;
+}): JSX.Element | null {
+ const t = useT();
+ if (options.length === 0) return null;
+ return (
+ <div data-testid={testId}>
+ <p className="text-[10px] uppercase tracking-wider text-muted-foreground">
+ {t(titleKey)}
+ </p>
+ <p className="mb-1.5 text-[11px] text-muted-foreground/80">{t(hintKey)}</p>
+ <div className="grid grid-cols-1 gap-2 sm:grid-cols-2">
+ {options.map((option) => (
+ <ConnectorTile
+ key={option.key}
+ option={option}
+ selected={option.key === selectedKey}
+ onSelect={() => onSelect(option)}
+ />
+ ))}
+ </div>
+ </div>
+ );
+}
+
+export function ConnectorPicker({
+ selectedKey,
+ onSelect,
+}: {
+ selectedKey: string;
+ onSelect: (option: ConnectorOption) => void;
+}): JSX.Element {
+ const t = useT();
+ const rosterQuery = useQuery({
+ queryKey: ["ultrawiki", "connectors"],
+ queryFn: fetchUltraWikiConnectors,
+ staleTime: 60_000,
+ });
+ const candidatesQuery = useQuery({
+ queryKey: ["ultrawiki", "bridge-candidates"],
+ queryFn: fetchUltraWikiBridgeCandidates,
+ staleTime: 5_000,
+ });
+
+ if (rosterQuery.isLoading) {
+ return (
+ <div
+ className="flex items-center gap-2 text-xs text-muted-foreground"
+ data-testid="uw-picker-loading"
+ >
+ <Loader2 className="h-3.5 w-3.5 animate-spin" aria-hidden />
+ {t("ultrawiki.panel.loading")}
+ </div>
+ );
+ }
+ if (rosterQuery.isError) {
+ return (
+ <p className="text-xs text-destructive" role="alert">
+ {t("ultrawiki.picker.load_failed")}
+ </p>
+ );
+ }
+
+ const roster = rosterQuery.data?.connectors ?? [];
+ // `null` means "not answered yet or not answerable" — both are the same
+ // thing to a tile: we do not know, so we do not claim. An empty ARRAY is a
+ // real answer (nothing connected) and does render the tiles.
+ const candidates = candidatesQuery.data?.candidates ?? null;
+ const options = mergeOptions(roster, candidates);
+ const builtins = options.filter((option) => option.kind === "builtin");
+ const bridges = options.filter((option) => option.kind !== "builtin");
+
+ return (
+ <div className="space-y-3" data-testid="uw-connector-picker">
+ {options.length === 0 && (
+ <p className="text-xs text-muted-foreground">
+ {t("ultrawiki.picker.empty")}
+ </p>
+ )}
+ <Group
+ testId="uw-picker-group-builtin"
+ titleKey="ultrawiki.picker.builtin_group"
+ hintKey="ultrawiki.picker.builtin_hint"
+ options={builtins}
+ selectedKey={selectedKey}
+ onSelect={onSelect}
+ />
+ {candidatesQuery.isError ? (
+ <p
+ className="flex items-start gap-1.5 text-[11px] text-destructive"
+ data-testid="uw-picker-candidates-failed"
+ role="alert"
+ >
+ <AlertCircle className="mt-0.5 h-3 w-3 shrink-0" aria-hidden />
+ {t("ultrawiki.picker.load_failed")}
+ </p>
+ ) : candidates === null ? (
+ <div
+ className="flex items-center gap-2 text-[11px] text-muted-foreground"
+ data-testid="uw-picker-candidates-loading"
+ >
+ <Loader2 className="h-3 w-3 animate-spin" aria-hidden />
+ {t("ultrawiki.panel.loading")}
+ </div>
+ ) : (
+ <Group
+ testId="uw-picker-group-bridge"
+ titleKey="ultrawiki.picker.bridge_group"
+ hintKey="ultrawiki.picker.bridge_hint"
+ options={bridges}
+ selectedKey={selectedKey}
+ onSelect={onSelect}
+ />
+ )}
+ </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
index 191a36cb07..ec191dbdc1 100644
--- a/jarvis/ui/web/frontend/src/components/ultrawiki/SourcesPanel.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/ultrawiki/SourcesPanel.test.tsx
@@ -347,10 +347,79 @@ describe("SourcesPanel — bridge sources carry a real identity", () => {
expect(subtitle.textContent).toContain("plugin:github");
});
- it("registers a bridge source under the picked candidate's label", async () => {
+ it("shows the source's brand mark next to its name", () => {
+ installFetchMock({});
+ const bridge = source({
+ id: "src-gh",
+ connector: "plugin-bridge",
+ label: "GitHub",
+ consent: "approved",
+ integration_id: "plugin:github",
+ brand: "github",
+ connector_kind: "bridge",
+ });
+ const folder = source({
+ id: "src-folder",
+ connector: "local-folder",
+ label: "Notes",
+ brand: "folder",
+ connector_kind: "builtin",
+ });
+
+ renderWithClient(
+ <SourcesPanel sources={[bridge, folder]} onChanged={vi.fn()} />,
+ );
+
+ // The same resolution the picker uses: a bundled vendor mark for the
+ // integration, one of our own icons for a built-in.
+ expect(
+ screen.getByTestId("uw-source-brand-src-gh").getAttribute("data-brand-tier"),
+ ).toBe("asset");
+ expect(
+ screen
+ .getByTestId("uw-source-brand-src-folder")
+ .getAttribute("data-brand-tier"),
+ ).toBe("neutral");
+ });
+
+ it("falls back to a monogram for a source with no roster brand", () => {
+ installFetchMock({});
+ const orphan = source({
+ id: "src-orphan",
+ connector: "third-party-connector",
+ label: "Zeta archive",
+ brand: "",
+ });
+
+ renderWithClient(<SourcesPanel sources={[orphan]} onChanged={vi.fn()} />);
+
+ const mark = screen.getByTestId("uw-source-brand-src-orphan");
+ expect(mark.getAttribute("data-brand-tier")).toBe("monogram");
+ expect(mark.textContent).toBe("Z");
+ });
+
+ it("registers a bridge source under the picked integration's label", async () => {
const created: unknown[] = [];
const fetchMock = installFetchMock({
"/api/ultrawiki/areas": () => ({ areas: [], total: 0 }),
+ "/api/ultrawiki/connectors": () => ({
+ connectors: [
+ {
+ id: "github",
+ kind: "bridge",
+ label: "GitHub",
+ label_key: "",
+ brand: "github",
+ status: "adapter_pending",
+ description_key: "ultrawiki.connectors.github",
+ connector: "plugin-bridge",
+ integration_id: "plugin:github",
+ },
+ ],
+ total: 1,
+ builtin: 0,
+ bridge: 1,
+ }),
"/api/ultrawiki/bridge/candidates": () => ({
candidates: [
{
@@ -358,9 +427,17 @@ describe("SourcesPanel — bridge sources carry a real identity", () => {
kind: "plugin",
label: "GitHub",
detail: "connected marketplace plugin; pull adapter pending",
+ catalog_id: "github",
+ brand: "github",
+ connector_kind: "bridge",
+ description_key: "ultrawiki.connectors.github",
+ status: "adapter_pending",
+ connected: true,
+ has_pull_adapter: false,
},
],
total: 1,
+ connected: 1,
}),
"/api/ultrawiki/sources": (init) => {
created.push(JSON.parse(String(init?.body ?? "{}")));
@@ -370,13 +447,15 @@ describe("SourcesPanel — bridge sources carry a real identity", () => {
renderWithClient(<SourcesPanel sources={[]} onChanged={vi.fn()} />);
fireEvent.click(screen.getByTestId("ultrawiki-add-source-toggle"));
- fireEvent.change(screen.getByTestId("ultrawiki-connector-select"), {
- target: { value: "plugin-bridge" },
- });
await waitFor(() => {
- expect(screen.getByTestId("ultrawiki-bridge-plugin:github")).toBeDefined();
+ expect(screen.getByTestId("uw-picker-github")).toBeDefined();
});
- fireEvent.click(screen.getByTestId("ultrawiki-bridge-plugin:github"));
+ // Nothing can be created before a source type is picked.
+ expect(
+ screen.getByTestId("ultrawiki-create-source").hasAttribute("disabled"),
+ ).toBe(true);
+
+ fireEvent.click(screen.getByTestId("uw-picker-github"));
fireEvent.click(screen.getByTestId("ultrawiki-create-source"));
await waitFor(() => {
diff --git a/jarvis/ui/web/frontend/src/components/ultrawiki/SourcesPanel.tsx b/jarvis/ui/web/frontend/src/components/ultrawiki/SourcesPanel.tsx
index e20ab59df3..d708bb37a2 100644
--- a/jarvis/ui/web/frontend/src/components/ultrawiki/SourcesPanel.tsx
+++ b/jarvis/ui/web/frontend/src/components/ultrawiki/SourcesPanel.tsx
@@ -15,16 +15,15 @@
* nothing to import — today that is a plugin-bridge integration whose pull
* adapter is not built yet.
*
- * "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`.
- * A bridge source is named after the integration the user picked ("GitHub"),
- * never after the generic bridge, so the list is readable.
+ * "Add source": the curated picker (`ConnectorPicker`) — a tile grid of the
+ * built-ins and the curated integrations, each with its real product name and
+ * brand mark — plus a path field for the folder-shaped connectors and area
+ * assignment. A bridge source is named after the integration the user picked
+ * ("GitHub"), never after the generic bridge, so the list stays readable.
*/
import { useState } from "react";
import {
AlertCircle,
- Check,
FolderOpen,
Info,
Loader2,
@@ -41,27 +40,22 @@ import { cn } from "@/lib/utils";
import { useT } from "@/i18n";
import { useEventStore } from "@/store/events";
import { formatRelativeTime } from "@/components/ultrawiki/relativeTime";
+import { ConnectorBrandMark } from "@/components/ultrawiki/ConnectorBrand";
+import {
+ ConnectorPicker,
+ connectorLabel,
+ type ConnectorOption,
+} from "@/components/ultrawiki/ConnectorPicker";
import {
- ULTRAWIKI_CONNECTOR_IDS,
approveUltraWikiSource,
cancelUltraWikiJob,
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"];
@@ -232,13 +226,24 @@ function SourceCard({
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 className="flex min-w-0 items-center gap-2">
+ {/* The same mark the picker offered this source under — the backend
+ derives it from the connector, so a card added before the roster
+ existed gets its logo too. */}
+ <ConnectorBrandMark
+ brand={source.brand ?? ""}
+ label={source.label}
+ size="sm"
+ testId={`uw-source-brand-${source.id}`}
+ />
+ <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>
</div>
<span
className={cn(
@@ -465,11 +470,9 @@ function AddSourceForm({
onCreated: () => void;
}): JSX.Element {
const t = useT();
- const [connector, setConnector] =
- useState<UltraWikiConnectorId>("obsidian-vault");
+ const [option, setOption] = useState<ConnectorOption | null>(null);
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("");
@@ -479,24 +482,12 @@ function AddSourceForm({
queryFn: fetchUltraWikiAreas,
staleTime: 5_000,
});
- const bridgeQuery = useQuery({
- queryKey: ["ultrawiki", "bridge-candidates"],
- queryFn: fetchUltraWikiBridgeCandidates,
- staleTime: 5_000,
- enabled: connector === BRIDGE_CONNECTOR,
- });
- const needsPath = PATH_CONNECTORS.includes(connector);
- const candidates = bridgeQuery.data?.candidates ?? [];
- const selectedCandidate =
- candidates.find((candidate) => candidate.id === integrationId) ?? null;
+ const needsPath = Boolean(option && PATH_CONNECTORS.includes(option.connector));
// A bridge card is named after the INTEGRATION the user picked. Falling back
// to the connector's own name produced a list of identical "Connected
// integration" rows nobody could tell apart.
- const defaultLabel =
- connector === BRIDGE_CONNECTOR && selectedCandidate
- ? selectedCandidate.label
- : t(CONNECTOR_LABEL_KEY[connector]);
+ const defaultLabel = option ? connectorLabel(option, t) : "";
function toggleArea(id: string) {
setSelectedAreas((current) =>
@@ -508,16 +499,17 @@ function AddSourceForm({
async function handleSubmit(e: React.FormEvent) {
e.preventDefault();
+ if (!option) return;
setSubmitting(true);
setError("");
const config: Record<string, unknown> = {};
if (needsPath && rootPath.trim()) config.root = rootPath.trim();
- if (connector === BRIDGE_CONNECTOR && integrationId) {
- config.integration_id = integrationId;
+ if (option.connector === BRIDGE_CONNECTOR && option.integrationId) {
+ config.integration_id = option.integrationId;
}
try {
await createUltraWikiSource({
- connector,
+ connector: option.connector,
label: label.trim() || defaultLabel,
config,
areas: selectedAreas,
@@ -548,38 +540,36 @@ function AddSourceForm({
{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">
+ <div>
<span className="mb-1.5 block text-[10px] uppercase tracking-wider text-muted-foreground">
- {t("ultrawiki.sources.label_label")}
+ {t("ultrawiki.picker.choose")}
</span>
- <input
- type="text"
- value={label}
- onChange={(e) => setLabel(e.target.value)}
- placeholder={defaultLabel}
- className={inputCls}
+ <ConnectorPicker
+ selectedKey={option?.key ?? ""}
+ onSelect={(picked) => {
+ setOption(picked);
+ // The path belongs to the folder connector it was typed for;
+ // carrying it over to a different source type would silently point
+ // the new one at an unrelated folder.
+ if (!PATH_CONNECTORS.includes(picked.connector)) setRootPath("");
+ }}
/>
- </label>
+ </div>
+
+ {option && (
+ <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={defaultLabel}
+ className={inputCls}
+ />
+ </label>
+ )}
{needsPath && (
<label className="block">
@@ -600,80 +590,6 @@ function AddSourceForm({
</label>
)}
- {connector === BRIDGE_CONNECTOR && (
- <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>
- ) : candidates.length === 0 ? (
- <p className="text-xs text-muted-foreground">
- {t("ultrawiki.sources.bridge_empty")}
- </p>
- ) : (
- <ul className="space-y-1.5">
- {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")}
@@ -719,11 +635,7 @@ function AddSourceForm({
<Button
size="sm"
type="submit"
- disabled={
- submitting ||
- (connector === BRIDGE_CONNECTOR && !integrationId) ||
- (needsPath && !rootPath.trim())
- }
+ disabled={submitting || !option || (needsPath && !rootPath.trim())}
data-testid="ultrawiki-create-source"
>
{submitting && (
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.json
index 0a0d59b929..27ffa2b7cc 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json
@@ -2975,6 +2975,41 @@
"action_open_sources": "Quellen öffnen",
"action_open_settings": "Einstellungen öffnen",
"action_enable_mode": "Einschalten"
+ },
+ "connectors": {
+ "obsidian_vault": "Jede Notiz in einem Obsidian-Tresor auf diesem Gerät.",
+ "local_folder": "Text- und Markdown-Dateien in einem Ordner deiner Wahl.",
+ "jarvis_conversations": "Worüber du und {name} schon gesprochen habt.",
+ "normal_wiki": "Die Notizen, die das eingebaute Wiki bereits gesammelt hat.",
+ "github": "Repositories, Issues und Pull Requests, an denen du arbeitest.",
+ "notion": "Seiten und Datenbanken aus deinem Notion-Workspace.",
+ "slack": "Nachrichten und Threads aus deinen Kanälen.",
+ "google_drive": "Dokumente und Dateien in deinem Drive.",
+ "gmail": "Gesendete und empfangene E-Mails.",
+ "google_calendar": "Termine, Einladungen und ihre Notizen.",
+ "asana": "Aufgaben, Projekte und ihre Beschreibungen.",
+ "linear": "Issues, Projekte und die Diskussionen dazu.",
+ "todoist": "Aufgaben und die Notizen daran.",
+ "clickup": "Aufgaben, Dokumente und Kommentare aus deinen Spaces.",
+ "dropbox": "Dokumente und Dateien in Dropbox.",
+ "airtable": "Datensätze aus deinen Bases und Tabellen.",
+ "discord": "Nachrichten aus den Servern und Kanälen, denen du folgst.",
+ "telegram": "Nachrichten aus deinen Chats und Kanälen."
+ },
+ "picker": {
+ "builtin_group": "Auf diesem Gerät",
+ "bridge_group": "Verbundene Apps",
+ "builtin_hint": "Wird direkt von diesem Gerät gelesen — nichts verlässt es.",
+ "bridge_hint": "Apps, die du unter Plugins verbunden hast.",
+ "badge_available": "Bereit zum Import",
+ "badge_adapter_pending": "Leser noch nicht gebaut",
+ "badge_not_connected": "Nicht verbunden",
+ "adapter_pending_hint": "Du kannst sie jetzt hinzufügen, aber eine Synchronisation findet nichts, bis ihr Leser fertig ist.",
+ "not_connected_hint": "Verbinde sie zuerst unter Plugins — danach lässt sie sich hier hinzufügen.",
+ "load_failed": "Die verbundenen Apps konnten nicht geladen werden.",
+ "empty": "In dieser Version werden keine Quellen angeboten.",
+ "selected": "Ausgewählt",
+ "choose": "Quelle auswählen"
}
}
}
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.json
index 01cac680bc..65beec603e 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json
@@ -2976,6 +2976,41 @@
"action_open_sources": "Open sources",
"action_open_settings": "Open settings",
"action_enable_mode": "Turn on"
+ },
+ "connectors": {
+ "obsidian_vault": "Every note in an Obsidian vault on this machine.",
+ "local_folder": "Text and Markdown files in any folder you choose.",
+ "jarvis_conversations": "What you and {name} have already talked about.",
+ "normal_wiki": "The notes the built-in wiki has already collected.",
+ "github": "Repositories, issues and pull requests you work on.",
+ "notion": "Pages and databases from your Notion workspace.",
+ "slack": "Messages and threads from the channels you are in.",
+ "google_drive": "Documents and files stored in your Drive.",
+ "gmail": "Mail you have sent and received.",
+ "google_calendar": "Events, invitations and the notes on them.",
+ "asana": "Tasks, projects and their descriptions.",
+ "linear": "Issues, projects and the discussions on them.",
+ "todoist": "Tasks and the notes attached to them.",
+ "clickup": "Tasks, docs and comments from your spaces.",
+ "dropbox": "Documents and files kept in Dropbox.",
+ "airtable": "Records from your bases and tables.",
+ "discord": "Messages from the servers and channels you follow.",
+ "telegram": "Messages from your chats and channels."
+ },
+ "picker": {
+ "builtin_group": "On this machine",
+ "bridge_group": "Connected apps",
+ "builtin_hint": "Read straight from this device — nothing leaves it.",
+ "bridge_hint": "Apps you have connected under Plugins.",
+ "badge_available": "Ready to import",
+ "badge_adapter_pending": "Reader not built yet",
+ "badge_not_connected": "Not connected",
+ "adapter_pending_hint": "You can add it now, but a sync finds nothing until its reader ships.",
+ "not_connected_hint": "Connect it under Plugins first — then it can be added here.",
+ "load_failed": "The connected apps could not be loaded.",
+ "empty": "This build offers no source types.",
+ "selected": "Selected",
+ "choose": "Pick a source type"
}
}
}
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.json
index c378c077c0..0e4a0a6c4c 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json
@@ -2975,6 +2975,41 @@
"action_open_sources": "Abrir fuentes",
"action_open_settings": "Abrir ajustes",
"action_enable_mode": "Activar"
+ },
+ "connectors": {
+ "obsidian_vault": "Cada nota de un almacén de Obsidian en este equipo.",
+ "local_folder": "Archivos de texto y Markdown en la carpeta que elijas.",
+ "jarvis_conversations": "Lo que ya has hablado con {name}.",
+ "normal_wiki": "Las notas que el wiki integrado ya ha recopilado.",
+ "github": "Repositorios, incidencias y pull requests en los que trabajas.",
+ "notion": "Páginas y bases de datos de tu espacio de Notion.",
+ "slack": "Mensajes e hilos de los canales en los que estás.",
+ "google_drive": "Documentos y archivos guardados en tu Drive.",
+ "gmail": "Correos que has enviado y recibido.",
+ "google_calendar": "Eventos, invitaciones y sus notas.",
+ "asana": "Tareas, proyectos y sus descripciones.",
+ "linear": "Incidencias, proyectos y sus discusiones.",
+ "todoist": "Tareas y las notas adjuntas a ellas.",
+ "clickup": "Tareas, documentos y comentarios de tus espacios.",
+ "dropbox": "Documentos y archivos guardados en Dropbox.",
+ "airtable": "Registros de tus bases y tablas.",
+ "discord": "Mensajes de los servidores y canales que sigues.",
+ "telegram": "Mensajes de tus chats y canales."
+ },
+ "picker": {
+ "builtin_group": "En este equipo",
+ "bridge_group": "Aplicaciones conectadas",
+ "builtin_hint": "Se lee directamente desde este equipo: nada sale de él.",
+ "bridge_hint": "Aplicaciones que has conectado en Plugins.",
+ "badge_available": "Listo para importar",
+ "badge_adapter_pending": "Lector aún no disponible",
+ "badge_not_connected": "Sin conectar",
+ "adapter_pending_hint": "Puedes añadirla ya, pero una sincronización no encontrará nada hasta que llegue su lector.",
+ "not_connected_hint": "Conéctala primero en Plugins y después podrás añadirla aquí.",
+ "load_failed": "No se pudieron cargar las aplicaciones conectadas.",
+ "empty": "Esta versión no ofrece ningún tipo de origen.",
+ "selected": "Seleccionado",
+ "choose": "Elige un tipo de origen"
}
}
}
diff --git a/jarvis/ui/web/frontend/src/lib/ultrawikiApi.ts b/jarvis/ui/web/frontend/src/lib/ultrawikiApi.ts
index b948e554bc..307352e58e 100644
--- a/jarvis/ui/web/frontend/src/lib/ultrawikiApi.ts
+++ b/jarvis/ui/web/frontend/src/lib/ultrawikiApi.ts
@@ -59,6 +59,51 @@ export const ULTRAWIKI_CONNECTOR_IDS = [
] as const;
export type UltraWikiConnectorId = (typeof ULTRAWIKI_CONNECTOR_IDS)[number];
+// Mirrors jarvis/ultrawiki/connector_catalog.py::CONNECTOR_KINDS — five-layer
+// anti-drift discipline (AP-4): pinned against Python by
+// tests/unit/ultrawiki/test_connector_catalog.py.
+export const ULTRAWIKI_CONNECTOR_KINDS = ["builtin", "bridge"] as const;
+export type UltraWikiConnectorKind =
+ (typeof ULTRAWIKI_CONNECTOR_KINDS)[number];
+
+// Mirrors jarvis/ultrawiki/connector_catalog.py::CONNECTOR_STATUSES.
+export const ULTRAWIKI_CONNECTOR_STATUSES = [
+ "available",
+ "adapter_pending",
+] as const;
+export type UltraWikiConnectorStatus =
+ (typeof ULTRAWIKI_CONNECTOR_STATUSES)[number];
+
+// Mirrors jarvis/ultrawiki/connector_catalog.py::NEUTRAL_BRANDS — brand tokens
+// that name one of OUR icons instead of a vendor mark.
+export const ULTRAWIKI_NEUTRAL_BRANDS = [
+ "vault",
+ "folder",
+ "chat",
+ "wiki",
+] as const;
+export type UltraWikiNeutralBrand =
+ (typeof ULTRAWIKI_NEUTRAL_BRANDS)[number];
+
+/** One offer in the add-source picker (`GET /api/ultrawiki/connectors`). */
+export interface UltraWikiConnectorSpec {
+ id: string;
+ kind: UltraWikiConnectorKind | string;
+ /** The real product name — the vendor's own spelling, never translated. */
+ label: string;
+ /** Built-ins only: i18n key of the display name (ours, so it translates). */
+ label_key: string;
+ /** Asset key under `src/assets/brands`, or one of ULTRAWIKI_NEUTRAL_BRANDS. */
+ brand: string;
+ status: UltraWikiConnectorStatus | string;
+ /** i18n key of the one-line description under the name. */
+ description_key: string;
+ /** The connector a source is registered under. */
+ connector: string;
+ /** Bridge entries only: the candidate id the source config carries. */
+ integration_id: string;
+}
+
export interface UltraWikiCounts {
captured: number;
keyword_indexed: number;
@@ -89,6 +134,10 @@ export interface UltraWikiSource {
label: string;
/** The integration behind a plugin-bridge source ("plugin:github"). */
integration_id?: string;
+ /** Brand asset key, so an existing card carries the same logo the picker
+ * offered it under. Empty when the connector is not on the roster. */
+ brand?: string;
+ connector_kind?: UltraWikiConnectorKind | string;
consent: UltraWikiConsent | string;
enabled: boolean;
areas: string[];
@@ -494,11 +543,28 @@ export interface UltraWikiSlotTestResult {
latency_ms: number;
}
+/**
+ * One curated integration in the picker (`GET /api/ultrawiki/bridge/candidates`).
+ *
+ * `kind` says where it was DISCOVERED (marketplace plugin or mcp.json server);
+ * `connector_kind` is always "bridge". Every field except `id`/`kind`/`detail`
+ * comes from the curated roster, so a registry's own display string can never
+ * reach a card. Entries with `connected: false` are offered but not usable yet
+ * — the user connects them under Plugins first.
+ */
export interface UltraWikiBridgeCandidate {
id: string;
kind: "plugin" | "mcp" | string;
label: string;
detail: string;
+ /** The roster entry id ("github"), which is also the brand asset key. */
+ catalog_id?: string;
+ brand?: string;
+ connector_kind?: UltraWikiConnectorKind | string;
+ description_key?: string;
+ status?: UltraWikiConnectorStatus | string;
+ connected?: boolean;
+ has_pull_adapter?: boolean;
}
export interface UltraWikiArea {
@@ -804,10 +870,28 @@ export function cancelUltraWikiJob(
export function fetchUltraWikiBridgeCandidates(): Promise<{
candidates: UltraWikiBridgeCandidate[];
total: number;
+ connected?: number;
}> {
- return request<{ candidates: UltraWikiBridgeCandidate[]; total: number }>(
- "/api/ultrawiki/bridge/candidates",
- );
+ return request<{
+ candidates: UltraWikiBridgeCandidate[];
+ total: number;
+ connected?: number;
+ }>("/api/ultrawiki/bridge/candidates");
+}
+
+/** The curated roster the picker renders — product data, not install state. */
+export function fetchUltraWikiConnectors(): Promise<{
+ connectors: UltraWikiConnectorSpec[];
+ total: number;
+ builtin?: number;
+ bridge?: number;
+}> {
+ return request<{
+ connectors: UltraWikiConnectorSpec[];
+ total: number;
+ builtin?: number;
+ bridge?: number;
+ }>("/api/ultrawiki/connectors");
}
export function fetchUltraWikiAreas(): Promise<{
diff --git a/jarvis/ultrawiki/service.py b/jarvis/ultrawiki/service.py
index 432b2dcb86..61c66a70ce 100644
--- a/jarvis/ultrawiki/service.py
+++ b/jarvis/ultrawiki/service.py
@@ -99,6 +99,25 @@ BRIDGE_ADAPTER_PENDING_NOTICE = (
#: state is the only one that produces the notice above).
_BRIDGE_CONNECTOR_ID = "plugin-bridge"
+def _connector_identity(connector_id: str, integration_id: str) -> tuple[str, str]:
+ """``(brand asset key, connector kind)`` for one registered source.
+
+ Derived on every read instead of stored with the source: the roster is a
+ product decision that must reach sources registered before it, and a brand
+ frozen into the database at creation time is exactly how a card ends up
+ showing a logo the app no longer ships. An unknown connector answers with
+ empty strings — the UI then draws a monogram, which is the honest rendering
+ of "this is not one of ours".
+ """
+ from jarvis.ultrawiki import connector_catalog # noqa: PLC0415 — lazy (AP-26)
+
+ if connector_id == _BRIDGE_CONNECTOR_ID:
+ spec = connector_catalog.bridge_entry_for(integration_id)
+ return (spec.brand if spec else "", "bridge")
+ spec = connector_catalog.get_connector(connector_id)
+ return (spec.brand, spec.kind) if spec else ("", "")
+
+
#: The default local sources :meth:`UltraWikiService.activate` registers —
#: source id == connector id for these singletons.
_DEFAULT_SOURCES: tuple[tuple[str, str], ...] = (
@@ -367,6 +386,18 @@ class UltraWikiService:
# -- lifecycle -----------------------------------------------------------
+ @staticmethod
+ def _register_pull_adapters() -> None:
+ """Wire the built-in integration readers into the plugin bridge."""
+ try:
+ from jarvis.ultrawiki.adapters import ( # noqa: PLC0415 — lazy (AP-26)
+ register_builtin_adapters,
+ )
+
+ register_builtin_adapters()
+ except Exception as exc: # noqa: BLE001 — no reader is not a boot failure
+ log.warning("UltraWiki: pull adapters could not register: %s", exc)
+
async def ensure_started(self) -> None:
"""Open the store and start the pipeline (idempotent, off boot path).
@@ -377,6 +408,12 @@ class UltraWikiService:
if self._store is None:
self._store = await self._open_store()
await self._heal_bridge_labels(self._store)
+ # The readers behind the plugin bridge. Registered HERE rather
+ # than at import time: an adapter reaches for credentials and
+ # HTTP clients, and the bridge must stay importable on a
+ # machine that has neither (AP-26). Idempotent and never
+ # raises — a broken adapter shortens the list, nothing more.
+ self._register_pull_adapters()
if self._uw_enabled() and self._pipeline_task is None:
from jarvis.ultrawiki.pipeline import ( # noqa: PLC0415 — lazy
PipelineWorker,
@@ -645,15 +682,23 @@ class UltraWikiService:
source_id = str(row.get("id") or "")
active = _active_job_for(source_id)
config = row.get("config") or {}
+ connector_id = str(row.get("connector") or "")
+ integration_id = (
+ str(config.get("integration_id") or "") if isinstance(config, dict) else ""
+ )
+ brand, connector_kind = _connector_identity(connector_id, integration_id)
return {
"id": row.get("id"),
- "connector": row.get("connector"),
+ "connector": connector_id,
"label": row.get("label"),
# The integration behind a plugin-bridge source, so the card can
# name it instead of showing an opaque generated source id.
- "integration_id": str(config.get("integration_id") or "")
- if isinstance(config, dict)
- else "",
+ "integration_id": integration_id,
+ # Brand identity of an EXISTING source, so its card carries the
+ # same logo the picker offered it under. Derived, never stored: a
+ # roster change must reach sources registered before it.
+ "brand": brand,
+ "connector_kind": connector_kind,
"consent": row.get("consent"),
"enabled": row.get("enabled"),
"areas": row.get("areas", []),
@@ -940,9 +985,16 @@ class UltraWikiService:
A plugin-bridge source registered under the bridge's own generic name
produced a list of identical "Connected Integrations" cards nobody
- could tell apart. When the caller supplied no real name, the label of
- the chosen candidate ("GitHub", "Notion", ...) is used instead. The
- lookup is best-effort: a broken registry keeps the caller's label.
+ could tell apart. When the caller supplied no real name, the product's
+ own name ("GitHub", "Notion", ...) is used instead.
+
+ The CATALOG answers first and the live registry only second. The
+ registry's display string is whatever a vendor or a hand-written
+ ``mcp.json`` put there and drifts into unreadable shapes; the roster
+ holds the real product name and, unlike the registry, still answers
+ when the integration has been disconnected in the meantime. Both
+ lookups are best-effort: neither may fail a source registration over
+ what is ultimately decoration.
"""
chosen = str(label or "").strip()
if connector_id != _BRIDGE_CONNECTOR_ID:
@@ -962,6 +1014,11 @@ class UltraWikiService:
}
if chosen.lower() not in generic:
return chosen
+ from jarvis.ultrawiki import connector_catalog # noqa: PLC0415 — lazy (AP-26)
+
+ spec = connector_catalog.bridge_entry_for(integration_id)
+ if spec is not None:
+ return spec.label
try:
from jarvis.ultrawiki.connectors import ( # noqa: PLC0415 — lazy (AP-26)
plugin_bridge,
diff --git a/tests/unit/ultrawiki/test_connector_catalog.py b/tests/unit/ultrawiki/test_connector_catalog.py
new file mode 100644
index 0000000000..a32594a9f8
--- /dev/null
+++ b/tests/unit/ultrawiki/test_connector_catalog.py
@@ -0,0 +1,185 @@
+"""The curated connector roster: shape, provenance, and its cross-layer twins.
+
+The roster is a PRODUCT surface — every entry becomes a tile with a logo and a
+real name — so the things that can silently rot are pinned here:
+
+* an entry naming a plugin the marketplace does not ship (unconnectable),
+* an entry whose brand mark is not bundled (a monogram where a logo belongs),
+* a description key no locale defines (the raw key rendered as UI text),
+* and the Python -> TypeScript value lists drifting apart (AP-4 / BUG-008).
+"""
+
+from __future__ import annotations
+
+import json
+import re
+from pathlib import Path
+
+import jarvis
+from jarvis.ultrawiki import connector_catalog as catalog
+from jarvis.ultrawiki.connectors import builtin_connectors
+
+PACKAGE_ROOT = Path(jarvis.__file__).resolve().parent
+FRONTEND_SRC = PACKAGE_ROOT / "ui" / "web" / "frontend" / "src"
+BRAND_DIR = FRONTEND_SRC / "assets" / "brands"
+LOCALE_DIR = FRONTEND_SRC / "i18n" / "locales"
+API_TS = FRONTEND_SRC / "lib" / "ultrawikiApi.ts"
+
+#: The bridge connector is plumbing, not a product — it must never be a card.
+BRIDGE_CONNECTOR_ID = "plugin-bridge"
+
+
+def _locale(name: str) -> dict:
+ return json.loads((LOCALE_DIR / f"{name}.json").read_text(encoding="utf-8"))
+
+
+def _resolve(locale: dict, dotted_key: str) -> object:
+ node: object = locale
+ for part in dotted_key.split("."):
+ if not isinstance(node, dict) or part not in node:
+ return None
+ node = node[part]
+ return node
+
+
+def _ts_string_array(name: str) -> list[str]:
+ """Read a `const <name> = [...] as const` array out of the TS module."""
+ source = API_TS.read_text(encoding="utf-8")
+ match = re.search(rf"const {name} = \[(.*?)\] as const", source, re.DOTALL)
+ assert match is not None, f"{name} not found in {API_TS.name}"
+ return re.findall(r'"([^"]+)"', match.group(1))
+
+
+class TestCatalogShape:
+ def test_ids_are_unique_across_the_whole_roster(self):
+ ids = [spec.id for spec in catalog.ALL_CONNECTORS]
+ assert len(ids) == len(set(ids))
+
+ def test_every_entry_is_fully_described(self):
+ for spec in catalog.ALL_CONNECTORS:
+ assert spec.label.strip(), f"{spec.id} has no label"
+ assert spec.brand.strip(), f"{spec.id} has no brand"
+ assert spec.kind in catalog.CONNECTOR_KINDS
+ assert spec.status in catalog.CONNECTOR_STATUSES
+ assert spec.description_key.startswith("ultrawiki.connectors.")
+
+ def test_builtins_cover_every_shipped_connector_except_the_bridge(self):
+ """A built-in connector missing here is unreachable from the picker."""
+ shipped = set(builtin_connectors()) - {BRIDGE_CONNECTOR_ID}
+ assert {spec.id for spec in catalog.BUILTIN_CONNECTORS} == shipped
+
+ def test_the_bridge_itself_is_not_offered_as_a_card(self):
+ assert catalog.get_connector(BRIDGE_CONNECTOR_ID) is None
+ assert not any(
+ spec.id == BRIDGE_CONNECTOR_ID for spec in catalog.ALL_CONNECTORS
+ )
+
+ def test_builtins_use_a_neutral_icon_and_a_translatable_name(self):
+ """A built-in has no vendor and must not borrow one's mark."""
+ for spec in catalog.BUILTIN_CONNECTORS:
+ assert spec.brand in catalog.NEUTRAL_BRANDS
+ assert spec.label_key.startswith("ultrawiki.")
+
+ def test_bridge_entries_declare_a_vendor_brand_and_no_label_key(self):
+ """A product name is the vendor's own spelling — never translated."""
+ for spec in catalog.BRIDGE_CONNECTORS:
+ assert spec.brand not in catalog.NEUTRAL_BRANDS
+ assert spec.label_key == ""
+
+ def test_as_dict_routes_builtins_and_bridges_to_the_right_connector(self):
+ for spec in catalog.BUILTIN_CONNECTORS:
+ row = catalog.as_dict(spec)
+ assert row["connector"] == spec.id
+ assert row["integration_id"] == ""
+ for spec in catalog.BRIDGE_CONNECTORS:
+ row = catalog.as_dict(spec)
+ assert row["connector"] == BRIDGE_CONNECTOR_ID
+ assert row["integration_id"] == f"plugin:{spec.id}"
+
+
+class TestRosterProvenance:
+ """Every bridge entry names something that actually EXISTS."""
+
+ def test_every_bridge_entry_is_a_plugin_the_marketplace_ships(self):
+ from jarvis.marketplace.catalog_data import load_catalog
+
+ shipped = {plugin.id for plugin in load_catalog().plugins}
+ offered = {spec.id for spec in catalog.BRIDGE_CONNECTORS}
+ assert offered <= shipped, (
+ "UltraWiki offers integrations the marketplace cannot connect: "
+ f"{sorted(offered - shipped)}"
+ )
+
+ def test_every_brand_key_has_a_bundled_mark(self):
+ """A missing file is not a crash — it is a monogram where a logo
+ belongs, which is exactly the regression this roster exists to end."""
+ missing = [
+ brand
+ for brand in sorted(catalog.brand_asset_keys())
+ if not (BRAND_DIR / f"{brand}.svg").is_file()
+ ]
+ assert missing == [], f"no bundled brand mark for: {missing}"
+
+
+class TestDescriptionsAreTranslated:
+ def test_every_description_key_resolves_in_every_locale(self):
+ for locale_name in ("en", "de", "es"):
+ locale = _locale(locale_name)
+ for spec in catalog.ALL_CONNECTORS:
+ text = _resolve(locale, spec.description_key)
+ assert isinstance(text, str) and text.strip(), (
+ f"{locale_name} has no text for {spec.description_key}"
+ )
+
+ def test_builtin_label_keys_resolve_too(self):
+ for locale_name in ("en", "de", "es"):
+ locale = _locale(locale_name)
+ for spec in catalog.BUILTIN_CONNECTORS:
+ assert isinstance(_resolve(locale, spec.label_key), str)
+
+
+class TestPythonTypeScriptParity:
+ """Five-layer discipline (AP-4): the picker branches on these values."""
+
+ def test_kinds_match(self):
+ assert _ts_string_array("ULTRAWIKI_CONNECTOR_KINDS") == list(
+ catalog.CONNECTOR_KINDS
+ )
+
+ def test_statuses_match(self):
+ assert _ts_string_array("ULTRAWIKI_CONNECTOR_STATUSES") == list(
+ catalog.CONNECTOR_STATUSES
+ )
+
+ def test_neutral_brands_match(self):
+ assert _ts_string_array("ULTRAWIKI_NEUTRAL_BRANDS") == list(
+ catalog.NEUTRAL_BRANDS
+ )
+
+
+class TestIntegrationIdMatching:
+ def test_both_discovery_prefixes_reach_the_same_entry(self):
+ """Where an integration was FOUND says nothing about what it is."""
+ from_plugin = catalog.bridge_entry_for("plugin:github")
+ from_mcp = catalog.bridge_entry_for("mcp:github")
+ assert from_plugin is not None
+ assert from_plugin is from_mcp
+
+ def test_spelling_variants_fold_onto_one_entry(self):
+ drive = catalog.get_connector("google_drive")
+ for spelling in ("plugin:google_drive", "mcp:google-drive", "mcp:gdrive"):
+ assert catalog.bridge_entry_for(spelling) is drive
+
+ def test_an_uncurated_integration_is_not_offered(self):
+ assert catalog.bridge_entry_for("mcp:some-private-server") is None
+ assert catalog.bridge_entry_for("plugin:stripe") is None
+ assert not catalog.is_offered("plugin:stripe")
+
+ def test_empty_and_bare_ids_are_handled(self):
+ assert catalog.bridge_entry_for("") is None
+ assert catalog.bridge_entry_for(" ") is None
+ # A bare product id (no prefix) still resolves — the prefix is metadata.
+ assert catalog.bridge_entry_for("notion") is catalog.get_connector("notion")
+
+ def test_a_builtin_id_is_never_a_bridge_integration(self):
+ assert catalog.bridge_entry_for("plugin:local-folder") is None
diff --git a/tests/unit/ultrawiki/test_connector_roster.py b/tests/unit/ultrawiki/test_connector_roster.py
new file mode 100644
index 0000000000..b45ba0e874
--- /dev/null
+++ b/tests/unit/ultrawiki/test_connector_roster.py
@@ -0,0 +1,259 @@
+"""The roster as a FILTER: what discovery finds vs. what UltraWiki offers.
+
+Discovery reads the user's registries and will happily report a payment
+processor, a deployment platform, and a hand-named MCP server. The picker must
+show none of those, must never render a registry's own display string, and must
+still show a curated integration the user has not connected — flagged, so it
+sends them to the Plugins store instead of registering a dead source.
+"""
+
+from __future__ import annotations
+
+from types import SimpleNamespace
+
+import pytest
+
+from jarvis.ultrawiki import connector_catalog as catalog
+from jarvis.ultrawiki.connectors import plugin_bridge
+from jarvis.ultrawiki.service import UltraWikiService, _connector_identity
+
+
+def _plugin(plugin_id: str, display_name: str, category: str = "Developer"):
+ return SimpleNamespace(
+ id=plugin_id, display_name=display_name, category=category
+ )
+
+
+def registries(monkeypatch: pytest.MonkeyPatch):
+ """Drive both discovery probes from one place.
+
+ ``connected`` holds the marketplace plugins with a live token; ``mcp`` holds
+ the raw ``mcp.json`` server map. Both start empty and a test fills what it
+ needs — the maintainer's own machine must never decide the outcome (§3).
+ """
+ import jarvis.marketplace.catalog_data as catalog_data
+ import jarvis.marketplace.token_store as token_store
+ import jarvis.mcp.state as mcp_state
+
+ state = SimpleNamespace(plugins=[], connected=set(), mcp={})
+
+ class FakeTokenStore:
+ def load(self, plugin_id: str):
+ if plugin_id in state.connected:
+ return SimpleNamespace(needs_reauth=False)
+ return None
+
+ monkeypatch.setattr(
+ catalog_data, "load_catalog", lambda: SimpleNamespace(plugins=state.plugins)
+ )
+ monkeypatch.setattr(token_store, "TokenStore", FakeTokenStore)
+ monkeypatch.setattr(mcp_state, "load_config", lambda: {"mcpServers": state.mcp})
+ return state
+
+
+class TestRosterFiltersDiscovery:
+ def test_an_uncurated_plugin_never_reaches_the_picker(self, registries):
+ registries.plugins = [
+ _plugin("github", "GitHub"),
+ _plugin("stripe", "Stripe"),
+ _plugin("vercel", "Vercel"),
+ ]
+ registries.connected = {"github", "stripe", "vercel"}
+
+ ids = [row["id"] for row in plugin_bridge.list_candidates()]
+ assert ids == ["plugin:github"]
+
+ def test_an_uncurated_mcp_server_never_reaches_the_picker(self, registries):
+ registries.mcp = {
+ "grace-plug-in-mcp": {"enabled": True},
+ "notion": {"enabled": True},
+ }
+
+ rows = plugin_bridge.list_candidates()
+ assert [row["id"] for row in rows] == ["mcp:notion"]
+
+ def test_an_unconnected_plugin_is_not_reported_as_connected(self, registries):
+ registries.plugins = [_plugin("github", "GitHub")]
+ registries.connected = set()
+ assert plugin_bridge.list_candidates() == []
+
+ def test_one_product_connected_twice_yields_one_card(self, registries):
+ """A plugin AND a hand-wired MCP server for the same product."""
+ registries.plugins = [_plugin("notion", "Notion")]
+ registries.connected = {"notion"}
+ registries.mcp = {"notion": {"enabled": True}}
+
+ rows = plugin_bridge.list_candidates()
+ assert [row["id"] for row in rows] == ["plugin:notion"]
+
+ def test_broken_registries_shorten_the_list_instead_of_raising(
+ self, monkeypatch: pytest.MonkeyPatch
+ ):
+ import jarvis.marketplace.catalog_data as catalog_data
+ import jarvis.mcp.state as mcp_state
+
+ def _boom(*_args, **_kwargs):
+ raise RuntimeError("registry down")
+
+ monkeypatch.setattr(catalog_data, "load_catalog", _boom)
+ monkeypatch.setattr(mcp_state, "load_config", _boom)
+ assert plugin_bridge.list_candidates() == []
+ # The roster half still answers: what EXISTS does not depend on what
+ # this machine has plugged in.
+ offered = plugin_bridge.list_offered_integrations()
+ assert len(offered) == len(catalog.BRIDGE_CONNECTORS)
+ assert all(row["connected"] is False for row in offered)
+
+
+class TestCandidateEnrichment:
+ def test_the_catalog_label_wins_over_the_registry_string(self, registries):
+ """Registry display strings drift; the product name does not."""
+ registries.plugins = [_plugin("notion", "notion (beta) - grace plug in")]
+ registries.connected = {"notion"}
+
+ row = plugin_bridge.list_candidates()[0]
+ assert row["label"] == "Notion"
+
+ def test_an_mcp_server_gets_the_product_name_not_its_config_name(
+ self, registries
+ ):
+ registries.mcp = {"google-drive": {"enabled": True, "display": "gdrive srv"}}
+
+ row = plugin_bridge.list_candidates()[0]
+ assert row["label"] == "Google Drive"
+ assert row["brand"] == "google_drive"
+ assert row["catalog_id"] == "google_drive"
+
+ def test_every_candidate_carries_the_fields_a_tile_needs(self, registries):
+ registries.plugins = [_plugin("slack", "Slack", "Messaging")]
+ registries.connected = {"slack"}
+
+ row = plugin_bridge.list_candidates()[0]
+ assert row["brand"] == "slack"
+ assert row["connector_kind"] == "bridge"
+ assert row["description_key"] == "ultrawiki.connectors.slack"
+ assert row["connected"] is True
+ # Discovery origin is preserved: it is WHERE it was found, not WHAT.
+ assert row["kind"] == "plugin"
+
+ def test_status_is_the_runtime_truth_not_the_catalog_claim(self, registries):
+ """A registered pull adapter means it really can be read today."""
+ registries.plugins = [_plugin("github", "GitHub")]
+ registries.connected = {"github"}
+ assert plugin_bridge.list_candidates()[0]["status"] == "adapter_pending"
+
+ async def _adapter(_ctx, _checkpoint): # pragma: no cover - never run
+ return
+ yield
+
+ plugin_bridge.register_pull_adapter("plugin:github", _adapter)
+ try:
+ row = plugin_bridge.list_candidates()[0]
+ assert row["status"] == "available"
+ assert row["has_pull_adapter"] is True
+ finally:
+ plugin_bridge.unregister_pull_adapter("plugin:github")
+
+ def test_candidates_keep_roster_order_not_discovery_order(self, registries):
+ registries.plugins = [
+ _plugin("telegram", "Telegram"),
+ _plugin("github", "GitHub"),
+ _plugin("notion", "Notion"),
+ ]
+ registries.connected = {"telegram", "github", "notion"}
+
+ order = [row["catalog_id"] for row in plugin_bridge.list_candidates()]
+ assert order == ["github", "notion", "telegram"]
+
+
+class TestOfferedIntegrations:
+ def test_the_picker_sees_curated_entries_it_has_not_connected(
+ self, registries
+ ):
+ registries.plugins = [_plugin("github", "GitHub")]
+ registries.connected = {"github"}
+
+ rows = plugin_bridge.list_offered_integrations()
+ assert len(rows) == len(catalog.BRIDGE_CONNECTORS)
+ by_id = {row["catalog_id"]: row for row in rows}
+ assert by_id["github"]["connected"] is True
+ assert by_id["notion"]["connected"] is False
+ # Not connected means not readable — never quietly "available".
+ assert by_id["notion"]["has_pull_adapter"] is False
+ assert by_id["notion"]["brand"] == "notion"
+
+ def test_connected_entries_come_first(self, registries):
+ registries.plugins = [_plugin("telegram", "Telegram")]
+ registries.connected = {"telegram"}
+
+ rows = plugin_bridge.list_offered_integrations()
+ assert rows[0]["catalog_id"] == "telegram"
+ assert all(not row["connected"] for row in rows[1:])
+
+ def test_nothing_outside_the_roster_can_appear(self, registries):
+ registries.plugins = [_plugin("stripe", "Stripe")]
+ registries.connected = {"stripe"}
+ registries.mcp = {"my-secret-server": {"enabled": True}}
+
+ offered = {row["catalog_id"] for row in plugin_bridge.list_offered_integrations()}
+ assert offered == {spec.id for spec in catalog.BRIDGE_CONNECTORS}
+
+
+class TestSourceIdentity:
+ def test_labels_resolve_through_the_catalog_first(self):
+ """No registry probe needed: the roster already knows the name."""
+ resolved = UltraWikiService._resolve_label(
+ "plugin-bridge",
+ "Connected integration (plugins / MCP)",
+ {"integration_id": "plugin:github"},
+ )
+ assert resolved == "GitHub"
+
+ def test_a_user_chosen_label_is_never_overwritten(self):
+ resolved = UltraWikiService._resolve_label(
+ "plugin-bridge", "Work repos", {"integration_id": "plugin:github"}
+ )
+ assert resolved == "Work repos"
+
+ def test_an_uncurated_integration_keeps_the_callers_label(self):
+ resolved = UltraWikiService._resolve_label(
+ "plugin-bridge",
+ "connected integration",
+ {"integration_id": "mcp:something-private"},
+ )
+ assert resolved == "connected integration"
+
+ def test_brand_and_kind_are_derived_for_builtins_and_bridges(self):
+ assert _connector_identity("local-folder", "") == ("folder", "builtin")
+ assert _connector_identity("obsidian-vault", "") == ("vault", "builtin")
+ assert _connector_identity("plugin-bridge", "plugin:slack") == (
+ "slack",
+ "bridge",
+ )
+
+ def test_an_unknown_connector_answers_honestly_instead_of_guessing(self):
+ """Empty means "not one of ours" — the UI then draws a monogram."""
+ assert _connector_identity("some-third-party", "") == ("", "")
+ assert _connector_identity("plugin-bridge", "mcp:private") == ("", "bridge")
+
+ def test_source_summaries_carry_the_brand_fields(self):
+ summary = UltraWikiService._source_summary(
+ {
+ "id": "plugin-bridge-abc123",
+ "connector": "plugin-bridge",
+ "label": "GitHub",
+ "config": {"integration_id": "plugin:github"},
+ "consent": "approved",
+ "enabled": True,
+ "areas": [],
+ "counts": None,
+ "sync_state": None,
+ "last_sync_at": None,
+ "last_error": None,
+ "last_notice": None,
+ }
+ )
+ assert summary["brand"] == "github"
+ assert summary["connector_kind"] == "bridge"
+ assert summary["integration_id"] == "plugin:github"
diff --git a/tests/unit/web/test_ultrawiki_routes.py b/tests/unit/web/test_ultrawiki_routes.py
index e86b5b97cc..3a5a10b476 100644
--- a/tests/unit/web/test_ultrawiki_routes.py
+++ b/tests/unit/web/test_ultrawiki_routes.py
@@ -1155,6 +1155,96 @@ def test_status_carries_the_per_source_outcome_after_the_auto_import(env) -> Non
assert row["last_notice"] is None
+# ---------------------------------------------------------------------------
+# The curated connector roster — what the add-source picker may render
+# ---------------------------------------------------------------------------
+
+
+def test_connectors_answer_with_the_whole_curated_roster(env) -> None:
+ """Product data: identical on every install, no credential probe involved."""
+ response = env.client.get("/api/ultrawiki/connectors")
+
+ assert response.status_code == 200, response.text
+ body = response.json()
+ assert body["total"] == body["builtin"] + body["bridge"]
+ assert body["builtin"] >= 4 and body["bridge"] >= 1
+ for row in body["connectors"]:
+ assert row["kind"] in ("builtin", "bridge")
+ assert row["label"].strip()
+ assert row["brand"].strip()
+ assert row["status"] in ("available", "adapter_pending")
+ assert row["description_key"].startswith("ultrawiki.connectors.")
+
+
+def test_connectors_never_offer_the_bridge_itself_as_a_card(env) -> None:
+ """`plugin-bridge` is plumbing; its generic name is what the roster ends."""
+ rows = env.client.get("/api/ultrawiki/connectors").json()["connectors"]
+ assert all(row["id"] != "plugin-bridge" for row in rows)
+ # It is still the connector every bridge entry registers under.
+ bridges = [row for row in rows if row["kind"] == "bridge"]
+ assert all(row["connector"] == "plugin-bridge" for row in bridges)
+
+
+def test_bridge_candidates_show_curated_entries_that_are_not_connected(
+ env, monkeypatch
+) -> None:
+ """Seeing what is POSSIBLE is the point — flagged, so nobody adds a dead
+ source by mistake."""
+ monkeypatch.setattr(
+ "jarvis.marketplace.catalog_data.load_catalog",
+ lambda: SimpleNamespace(plugins=[]),
+ )
+ monkeypatch.setattr("jarvis.mcp.state.load_config", lambda: {"mcpServers": {}})
+
+ body = env.client.get("/api/ultrawiki/bridge/candidates").json()
+
+ assert body["connected"] == 0
+ assert body["total"] > 0
+ for row in body["candidates"]:
+ assert row["connected"] is False
+ assert row["connector_kind"] == "bridge"
+ assert row["brand"].strip()
+ assert row["label"].strip()
+
+
+def test_bridge_candidates_exclude_an_uncurated_connected_tool(
+ env, monkeypatch
+) -> None:
+ """A raw registry dump is exactly what the picker must never render."""
+ monkeypatch.setattr(
+ "jarvis.marketplace.catalog_data.load_catalog",
+ lambda: SimpleNamespace(plugins=[]),
+ )
+ monkeypatch.setattr(
+ "jarvis.mcp.state.load_config",
+ lambda: {
+ "mcpServers": {
+ "notion": {"enabled": True},
+ "some-private-server": {"enabled": True, "display": "grace plug in"},
+ }
+ },
+ )
+
+ body = env.client.get("/api/ultrawiki/bridge/candidates").json()
+
+ connected = [row for row in body["candidates"] if row["connected"]]
+ assert [row["catalog_id"] for row in connected] == ["notion"]
+ assert connected[0]["label"] == "Notion"
+ assert all("grace plug in" not in row["label"] for row in body["candidates"])
+
+
+def test_status_sources_carry_the_brand_a_card_renders(env) -> None:
+ _activate(env)
+ rows = env.client.get("/api/ultrawiki/status").json()["sources"]
+
+ assert rows, "activation registers the default local sources"
+ for row in rows:
+ assert row["connector_kind"] in ("builtin", "bridge", "")
+ assert "brand" in row
+ wiki = next(row for row in rows if row["connector"] == "normal-wiki")
+ assert (wiki["brand"], wiki["connector_kind"]) == ("wiki", "builtin")
+
+
# ---------------------------------------------------------------------------
# The contents view — WHICH items are in the database, not just how many
# ---------------------------------------------------------------------------