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: add UltraWiki subscription model cards

Ruben Lütkec1b812011ebc
diff --git a/jarvis/memory/wiki/curator_llm.py b/jarvis/memory/wiki/curator_llm.py
index 31d280260e..8a08595221 100644
--- a/jarvis/memory/wiki/curator_llm.py
+++ b/jarvis/memory/wiki/curator_llm.py
@@ -29,6 +29,7 @@ import functools
import json
import logging
import time
+from collections.abc import Mapping
from pathlib import Path
from typing import TYPE_CHECKING, Any
@@ -157,6 +158,7 @@ def instantiate_curator_brain(
model: str | None,
*,
cli_timeout_s: float | None = None,
+ provider_options: Mapping[str, Any] | None = None,
) -> Any:
"""Instantiate a curator-tier brain with extended thinking DISABLED.
@@ -170,7 +172,7 @@ def instantiate_curator_brain(
never see the kwarg; a ``TypeError`` from an older provider signature
falls back to plain instantiation.
"""
- kwargs: dict[str, Any] = {"model": model}
+ kwargs: dict[str, Any] = {"model": model, **dict(provider_options or {})}
if provider == "gemini" and "pro" not in (model or "").lower():
kwargs["thinking_budget"] = 0
# Subscription-CLI brains (codex, antigravity) flatten voice turns into a
diff --git a/jarvis/memory/wiki/provider_chain.py b/jarvis/memory/wiki/provider_chain.py
index 86ca1ff9ed..f1761142f3 100644
--- a/jarvis/memory/wiki/provider_chain.py
+++ b/jarvis/memory/wiki/provider_chain.py
@@ -26,7 +26,7 @@ import asyncio
import logging
import re
import time
-from collections.abc import Callable
+from collections.abc import Callable, Mapping
from typing import Any
from jarvis.core.redact import safe_preview
@@ -121,29 +121,27 @@ def _exception_summary(exc: Exception) -> str:
diagnosis = _SAFE_DIAGNOSIS_RE.search(str(exc))
return f"{summary} ({diagnosis.group(0)})" if diagnosis else summary
-def _cli_login_ready(provider: str) -> bool | None:
- """Login-readiness of a subscription-CLI provider; ``None`` = not CLI-backed.
+def subscription_login_ready(provider: str, *, registry: Any = None) -> bool | None:
+ """Subscription-login readiness; ``None`` means no such capability.
- Codex and Antigravity are callable WITHOUT an API key — but only when
- their official CLI is installed and logged in. Without this probe an
- uninstalled/logged-out CLI provider entered every wiki chain and failed
- on every single call (live 2026-07-18: antigravity produced chain errors
- on machines that never installed it). A probe failure returns ``None``
- (unknown) so an auth-service hiccup can never empty the chain.
+ Subscription-backed brains advertise a ``subscription_connected`` class
+ capability. Resolving it through the provider registry keeps the chain open
+ to future CLIs without another vendor-name branch (AP-21). A failed probe
+ stays unknown rather than false so one status-service fault cannot empty an
+ otherwise usable fallback chain.
"""
try:
- if provider == "codex":
- from jarvis.codex_auth import CodexAuthService
-
- return bool(CodexAuthService().status().connected)
- if provider == "antigravity":
- from jarvis.google_cli.auth_service import GoogleCliAuthService
-
- status = GoogleCliAuthService().status()
- return bool(status.installed and status.connected)
- except Exception: # noqa: BLE001 — a probe failure must never empty the chain
+ if registry is None:
+ from jarvis.brain.provider_registry import BrainProviderRegistry
+
+ registry = BrainProviderRegistry()
+ provider_class = registry.get_class(provider)
+ probe = getattr(provider_class, "subscription_connected", None)
+ if not callable(probe):
+ return None
+ return bool(probe())
+ except Exception: # noqa: BLE001 - a probe failure must never empty the chain
return None
- return None
def credential_ready_wiki_providers(
@@ -161,14 +159,16 @@ def credential_ready_wiki_providers(
WITH a key mapping is also admitted when its CLI login is connected, so a
keyless Codex-subscription user keeps the wiki working.
"""
+ from jarvis.brain.provider_registry import BrainProviderRegistry
from jarvis.core.config import (
PROVIDER_SECRET_CANDIDATES,
resolve_provider_endpoint,
)
ready: set[str] = set()
+ registry = BrainProviderRegistry()
for provider in available:
- cli_ready = _cli_login_ready(provider)
+ cli_ready = subscription_login_ready(provider, registry=registry)
if provider not in PROVIDER_SECRET_CANDIDATES:
if cli_ready is False:
continue
@@ -233,6 +233,7 @@ async def complete_with_fallback(
allow_last_rejection: Callable[[str], bool] | None = None,
allow_lone_rejection: Callable[[str], bool] | None = None,
content_verdict: Callable[[str], bool] | None = None,
+ provider_options: Mapping[str, Mapping[str, Any]] | None = None,
) -> tuple[Any, str] | None:
"""Try each ``(provider, model)`` until one returns an aggregated response.
@@ -287,7 +288,11 @@ async def complete_with_fallback(
for index, (provider, model) in enumerate(ordered):
try:
brain = instantiate_curator_brain(
- registry, provider, model, cli_timeout_s=timeout_s,
+ registry,
+ provider,
+ model,
+ cli_timeout_s=timeout_s,
+ provider_options=(provider_options or {}).get(provider),
)
except Exception as exc: # noqa: BLE001 — a bad provider must not abort the chain
detail = _exception_summary(exc)
@@ -517,4 +522,5 @@ __all__ = [
"complete_with_fallback",
"credential_ready_wiki_providers",
"reset_provider_failure_memory",
+ "subscription_login_ready",
]
diff --git a/jarvis/plugins/brain/claude_cli.py b/jarvis/plugins/brain/claude_cli.py
index 73fb2ac9c8..719d87ef6b 100644
--- a/jarvis/plugins/brain/claude_cli.py
+++ b/jarvis/plugins/brain/claude_cli.py
@@ -106,7 +106,10 @@ def _claude_subscription_connected() -> bool:
from jarvis.claude_auth import ClaudeAuthService
status = ClaudeAuthService().status()
- return bool(getattr(status, "connected", False))
+ return bool(
+ getattr(status, "connected", False)
+ and getattr(status, "mode", "") == "subscription"
+ )
except Exception: # noqa: BLE001 - a probe degrades, never raises
log.debug("claude-cli: subscription probe failed", exc_info=True)
return False
diff --git a/jarvis/plugins/brain/codex.py b/jarvis/plugins/brain/codex.py
index 9bfb0e9e59..ad72ff13c3 100644
--- a/jarvis/plugins/brain/codex.py
+++ b/jarvis/plugins/brain/codex.py
@@ -23,6 +23,7 @@ import asyncio
import json
import logging
import os
+import re
import shutil
import sys
import tempfile
@@ -55,6 +56,8 @@ DEFAULT_MODEL = "gpt-5.5"
# forever if the subscription is unreachable.
_CLI_TIMEOUT_S: float = 90.0
+_CLI_MODEL_RE = re.compile(r"^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$")
+
def _resolve_codex_binary() -> str | None:
"""On-PATH ``codex`` binary (Windows shim variants included), or None."""
@@ -80,6 +83,28 @@ def _codex_oauth_connected() -> bool:
return False
+def _build_cli_command(binary: str, model: str | None) -> list[str]:
+ """Build the read-only subscription CLI command with an optional model."""
+ cmd = [
+ binary,
+ "exec",
+ "--json",
+ "--skip-git-repo-check",
+ "--sandbox",
+ "read-only",
+ "-c",
+ "approval_policy=never",
+ ]
+ selected = str(model or "").strip()
+ if selected:
+ if not _CLI_MODEL_RE.fullmatch(selected):
+ raise RuntimeError(
+ "Codex subscription model id contains unsupported characters."
+ )
+ cmd.extend(["--model", selected])
+ return cmd
+
+
# Light system instruction for the CLI path. Keeps codex answering as a
# conversational assistant instead of an autonomous coding agent — paired with
# ``--sandbox read-only`` so it physically cannot write files or run risky
@@ -145,14 +170,24 @@ class CodexBrain:
model: str | None = None,
structured_prompts: bool = False,
cli_timeout_s: float | None = None,
+ prefer_subscription: bool = False,
) -> None:
self._model = model or DEFAULT_MODEL
+ # Empty means "use the subscription CLI default". Keep this distinct
+ # from the API fallback model so an unpinned subscription never gets an
+ # unrelated API default forced onto it.
+ self._cli_model = str(model or "").strip()
self._client: Any = None
# Background/structured callers (the wiki curator tier) set this so the
# CLI path forwards their JSON contract verbatim instead of the
# conversational "answer in 1-3 plain-text sentences" wrapper — which
# made structured output impossible by instruction.
self._structured_prompts = bool(structured_prompts)
+ # Capability hint for surfaces that explicitly present the ChatGPT
+ # subscription as a separate choice from the OpenAI API card. Without
+ # it, a stored API key silently wins and the user's selected
+ # subscription card is billed through the API instead.
+ self._prefer_subscription = bool(prefer_subscription)
# Slow background callers (the wiki Stage-2 judge sends ~16k-char
# body-aware prompts) pass their own per-call budget; the voice-tier
# default stays the tight cap. Live 2026-07-21: the judge died on
@@ -164,7 +199,7 @@ class CodexBrain:
budget = 0.0
self._cli_timeout_s = budget if budget > 0 else _CLI_TIMEOUT_S
# Only the API-key path can see images (see the supports_vision note).
- self.supports_vision = bool(self._api_key())
+ self.supports_vision = bool(self._api_key()) and not self._prefer_subscription
@staticmethod
def subscription_connected() -> bool:
@@ -185,7 +220,7 @@ class CodexBrain:
run a tool/Computer-Use turn itself. The caller (``BrainManager``) uses
this to delegate tool turns to a tool-capable provider instead of letting
the CLI confabulate a refusal."""
- return bool(self._api_key())
+ return bool(self._api_key()) and not self._prefer_subscription
# ---- API-key path -------------------------------------------------
@@ -236,16 +271,7 @@ class CodexBrain:
for k, v in os.environ.items()
if k not in ("OPENAI_API_KEY", "CODEX_HOME")
}
- cmd = [
- binary,
- "exec",
- "--json",
- "--skip-git-repo-check",
- "--sandbox",
- "read-only",
- "-c",
- "approval_policy=never",
- ]
+ cmd = _build_cli_command(binary, self._cli_model)
creationflags = NO_WINDOW_CREATIONFLAGS if sys.platform == "win32" else 0
log.info(
"CodexBrain CLI: spawning '%s exec' for the ChatGPT-login brain "
@@ -386,6 +412,25 @@ class CodexBrain:
# ---- public API ---------------------------------------------------
async def complete(self, req: BrainRequest) -> AsyncIterator[BrainDelta]:
+ if self._prefer_subscription:
+ if req.tools:
+ raise RuntimeError(
+ "Codex ChatGPT subscription mode cannot execute brain tools."
+ )
+ oauth = await asyncio.to_thread(_codex_oauth_connected)
+ if not oauth:
+ raise RuntimeError(
+ "Codex ChatGPT subscription login is not connected."
+ )
+ log.info(
+ "CodexBrain.complete: explicit ChatGPT-subscription path "
+ "(model=%s)",
+ self._model,
+ )
+ async for delta in self._complete_via_cli(req):
+ yield delta
+ return
+
api_key = self._api_key()
if api_key:
log.info("CodexBrain.complete: API-key path (model=%s)", self._model)
diff --git a/jarvis/ui/web/frontend/src/components/ultrawiki/SlotsPanel.test.tsx b/jarvis/ui/web/frontend/src/components/ultrawiki/SlotsPanel.test.tsx
index 9028e04c76..16966663bc 100644
--- a/jarvis/ui/web/frontend/src/components/ultrawiki/SlotsPanel.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/ultrawiki/SlotsPanel.test.tsx
@@ -16,6 +16,7 @@ import {
fireEvent,
render,
screen,
+ within,
waitFor,
} from "@testing-library/react";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
@@ -121,6 +122,25 @@ const CATALOG: UltraWikiCatalog = {
}),
],
distill: [
+ row({
+ id: "codex",
+ slot: "distill",
+ label: "OpenAI Codex (ChatGPT subscription)",
+ auth_mode: "codex",
+ ready: true,
+ }),
+ row({
+ id: "antigravity",
+ slot: "distill",
+ label: "Antigravity (Google subscription)",
+ auth_mode: "antigravity",
+ }),
+ row({
+ id: "claude-cli",
+ slot: "distill",
+ label: "Claude (Anthropic subscription)",
+ auth_mode: "claude_cli",
+ }),
row({
id: "gemini",
slot: "distill",
@@ -209,6 +229,39 @@ function installFetchMock(overrides: Record<string, () => Response> = {}) {
}),
} as Response;
}
+ if (url.startsWith("/api/codex/status")) {
+ return {
+ ok: true,
+ status: 200,
+ json: async () => ({
+ installed: true,
+ connected: true,
+ mode: "chatgpt",
+ }),
+ } as Response;
+ }
+ if (url.startsWith("/api/antigravity/status")) {
+ return {
+ ok: true,
+ status: 200,
+ json: async () => ({
+ installed: true,
+ connected: false,
+ mode: "unknown",
+ }),
+ } as Response;
+ }
+ if (url.startsWith("/api/claude/status")) {
+ return {
+ ok: true,
+ status: 200,
+ json: async () => ({
+ installed: true,
+ connected: false,
+ mode: "unknown",
+ }),
+ } as Response;
+ }
if (url.startsWith("/api/ultrawiki/settings")) {
putBodies.push(JSON.parse(String(init?.body ?? "{}")));
return {
@@ -343,4 +396,52 @@ describe("SlotsPanel", () => {
),
).toBe("true");
});
+
+ it("offers every Jarvis-Agent subscription as a distillation card", async () => {
+ renderWithClient(<SlotsPanel status={STATUS} onChanged={() => {}} />);
+
+ expect(await screen.findByTestId("ultrawiki-card-distill-codex")).toBeDefined();
+ expect(screen.getByTestId("ultrawiki-card-distill-antigravity")).toBeDefined();
+ expect(screen.getByTestId("ultrawiki-card-distill-claude-cli")).toBeDefined();
+ expect(screen.getByTestId("ultrawiki-subscription-codex")).toBeDefined();
+ expect(screen.getByTestId("ultrawiki-subscription-antigravity")).toBeDefined();
+ expect(screen.getByTestId("ultrawiki-subscription-claude_cli")).toBeDefined();
+ });
+
+ it("switches to a subscription without carrying another provider's model", async () => {
+ renderWithClient(<SlotsPanel status={STATUS} onChanged={() => {}} />);
+
+ fireEvent.click(await screen.findByTestId("ultrawiki-use-distill-codex"));
+ await waitFor(() => expect(putBodies).toHaveLength(1));
+ expect(putBodies[0]).toEqual({
+ distill_provider: "codex",
+ distill_model: "",
+ });
+ });
+
+ it("shows the shared model picker on a selected subscription card", async () => {
+ const selectedCatalog: UltraWikiCatalog = {
+ ...CATALOG,
+ slots: {
+ ...CATALOG.slots,
+ distill: CATALOG.slots.distill.map((entry) => ({
+ ...entry,
+ selected: entry.id === "codex",
+ })),
+ },
+ selected: { ...CATALOG.selected, distill: "codex" },
+ };
+ installFetchMock({
+ "/api/ultrawiki/catalog": () =>
+ ({
+ ok: true,
+ status: 200,
+ json: async () => selectedCatalog,
+ }) as Response,
+ });
+
+ renderWithClient(<SlotsPanel status={STATUS} onChanged={() => {}} />);
+ const card = await screen.findByTestId("ultrawiki-card-distill-codex");
+ expect(within(card).getByRole("button", { name: /model/i })).toBeDefined();
+ });
});
diff --git a/jarvis/ui/web/frontend/src/components/ultrawiki/SlotsPanel.tsx b/jarvis/ui/web/frontend/src/components/ultrawiki/SlotsPanel.tsx
index 752ae4345b..e9e4848590 100644
--- a/jarvis/ui/web/frontend/src/components/ultrawiki/SlotsPanel.tsx
+++ b/jarvis/ui/web/frontend/src/components/ultrawiki/SlotsPanel.tsx
@@ -426,7 +426,15 @@ function DistillSection({
key={row.id}
row={row}
busy={pending}
- onSelect={() => void apply({ distill_provider: row.id })}
+ onSelect={() =>
+ void apply({
+ distill_provider: row.id,
+ // Models are provider-scoped. Carrying Gemini's model id
+ // into a Codex/Claude subscription card makes the first
+ // background call fail before the user can open the picker.
+ distill_model: row.default_model,
+ })
+ }
onCredentialChanged={refresh}
>
{row.selected && (
diff --git a/jarvis/ui/web/frontend/src/components/ultrawiki/UltraProviderCard.tsx b/jarvis/ui/web/frontend/src/components/ultrawiki/UltraProviderCard.tsx
index 038cbb57cb..051bf64288 100644
--- a/jarvis/ui/web/frontend/src/components/ultrawiki/UltraProviderCard.tsx
+++ b/jarvis/ui/web/frontend/src/components/ultrawiki/UltraProviderCard.tsx
@@ -23,6 +23,10 @@ import { ApiKeyForm } from "@/components/ApiKeyForm";
import { cn } from "@/lib/utils";
import { useT } from "@/i18n";
import type { UltraWikiCatalogRow } from "@/lib/ultrawikiApi";
+import {
+ isSubscriptionAuthMode,
+ UltraSubscriptionAuth,
+} from "@/components/ultrawiki/UltraSubscriptionAuth";
const STATE_CHIP_TONE = {
active: "border-primary/40 bg-primary/15 text-primary font-semibold",
@@ -114,7 +118,10 @@ export function UltraProviderCard({
footer?: ReactNode;
}): JSX.Element {
const t = useT();
- const keyless = row.auth_mode === "none";
+ const subscriptionAuthMode = isSubscriptionAuthMode(row.auth_mode)
+ ? row.auth_mode
+ : null;
+ const keyless = row.auth_mode === "none" || subscriptionAuthMode !== null;
const managed = row.auth_mode === "managed_link";
// A card click selects, EXCEPT on an interactive child — clicking into the
@@ -218,6 +225,13 @@ export function UltraProviderCard({
</p>
)}
+ {subscriptionAuthMode && (
+ <UltraSubscriptionAuth
+ authMode={subscriptionAuthMode}
+ onChanged={onCredentialChanged}
+ />
+ )}
+
{children}
{/* Credentials sit at the bottom of every card, so a row of cards lines
diff --git a/jarvis/ui/web/frontend/src/components/ultrawiki/UltraSubscriptionAuth.tsx b/jarvis/ui/web/frontend/src/components/ultrawiki/UltraSubscriptionAuth.tsx
new file mode 100644
index 0000000000..71ee4f484b
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/ultrawiki/UltraSubscriptionAuth.tsx
@@ -0,0 +1,224 @@
+/**
+ * Subscription-login control shared by the UltraWiki distillation cards.
+ *
+ * The three supported CLI brains expose the same capability (installed,
+ * connected, account identity) through different auth endpoints. Branching on
+ * the declared auth mode keeps provider names out of the component (AP-21),
+ * while reusing the established login/logout actions from the Jarvis-Agent UI.
+ */
+import { useCallback, useEffect, useState } from "react";
+import { Loader2, LogIn, LogOut } from "lucide-react";
+
+import { Button } from "@/components/ui/button";
+import {
+ codexLogout,
+ loginAntigravity,
+ loginClaude,
+ logoutAntigravity,
+ logoutClaude,
+ startCodexLogin,
+} from "@/hooks/useProviders";
+import { useT } from "@/i18n";
+import type { UltraWikiAuthMode } from "@/lib/ultrawikiApi";
+import { useEventStore } from "@/store/events";
+
+type SubscriptionAuthMode = Extract<
+ UltraWikiAuthMode,
+ "codex" | "antigravity" | "claude_cli"
+>;
+
+interface SubscriptionStatus {
+ installed: boolean;
+ connected: boolean;
+ mode: string;
+ user_email?: string | null;
+ account_label?: string | null;
+ accountLabel?: string | null;
+}
+
+interface AuthDriver {
+ statusUrl: string;
+ connect: () => Promise<void>;
+ disconnect: () => Promise<void>;
+ isSubscriptionConnected: (status: SubscriptionStatus) => boolean;
+}
+
+const AUTH_DRIVERS: Record<SubscriptionAuthMode, AuthDriver> = {
+ codex: {
+ statusUrl: "/api/codex/status",
+ connect: startCodexLogin,
+ disconnect: codexLogout,
+ isSubscriptionConnected: (status) =>
+ status.connected && status.mode === "chatgpt",
+ },
+ antigravity: {
+ statusUrl: "/api/antigravity/status",
+ connect: loginAntigravity,
+ disconnect: logoutAntigravity,
+ isSubscriptionConnected: (status) =>
+ status.connected && status.mode === "oauth-personal",
+ },
+ claude_cli: {
+ statusUrl: "/api/claude/status",
+ connect: loginClaude,
+ disconnect: logoutClaude,
+ isSubscriptionConnected: (status) =>
+ status.connected && status.mode === "subscription",
+ },
+};
+
+export function isSubscriptionAuthMode(
+ mode: UltraWikiAuthMode,
+): mode is SubscriptionAuthMode {
+ return mode in AUTH_DRIVERS;
+}
+
+async function fetchStatus(driver: AuthDriver): Promise<SubscriptionStatus> {
+ const response = await fetch(driver.statusUrl);
+ if (!response.ok) throw new Error(`HTTP ${response.status}`);
+ return (await response.json()) as SubscriptionStatus;
+}
+
+export function UltraSubscriptionAuth({
+ authMode,
+ onChanged,
+}: {
+ authMode: SubscriptionAuthMode;
+ onChanged: () => void;
+}): JSX.Element {
+ const t = useT();
+ const pushToast = useEventStore((state) => state.pushToast);
+ const driver = AUTH_DRIVERS[authMode];
+ const [status, setStatus] = useState<SubscriptionStatus | null>(null);
+ const [pending, setPending] = useState(false);
+ const [statusError, setStatusError] = useState(false);
+
+ const reload = useCallback(async (): Promise<SubscriptionStatus | null> => {
+ try {
+ const next = await fetchStatus(driver);
+ setStatus(next);
+ setStatusError(false);
+ return next;
+ } catch {
+ setStatusError(true);
+ return null;
+ }
+ }, [driver]);
+
+ useEffect(() => {
+ void reload();
+ }, [reload]);
+
+ const connected = Boolean(
+ status && driver.isSubscriptionConnected(status),
+ );
+ const account =
+ status?.user_email ?? status?.account_label ?? status?.accountLabel ?? null;
+
+ async function pollUntilConnected(): Promise<void> {
+ const deadline = Date.now() + 120_000;
+ while (Date.now() < deadline) {
+ await new Promise((resolve) => window.setTimeout(resolve, 2_500));
+ const next = await reload();
+ if (next && driver.isSubscriptionConnected(next)) {
+ pushToast("success", t("ultrawiki.subscription.connected"));
+ onChanged();
+ return;
+ }
+ }
+ }
+
+ async function connect(): Promise<void> {
+ setPending(true);
+ try {
+ await driver.connect();
+ pushToast("info", t("ultrawiki.subscription.login_started"));
+ onChanged();
+ void pollUntilConnected();
+ } catch (error) {
+ pushToast(
+ "error",
+ t("ultrawiki.subscription.login_failed").replace(
+ "{0}",
+ (error as Error).message,
+ ),
+ );
+ } finally {
+ setPending(false);
+ }
+ }
+
+ async function disconnect(): Promise<void> {
+ setPending(true);
+ try {
+ await driver.disconnect();
+ await reload();
+ onChanged();
+ pushToast("info", t("ultrawiki.subscription.disconnected"));
+ } catch (error) {
+ pushToast(
+ "error",
+ t("ultrawiki.subscription.disconnect_failed").replace(
+ "{0}",
+ (error as Error).message,
+ ),
+ );
+ } finally {
+ setPending(false);
+ }
+ }
+
+ return (
+ <div
+ className="space-y-2 rounded-md border border-border/60 bg-muted/20 p-2.5"
+ data-testid={`ultrawiki-subscription-${authMode}`}
+ >
+ <div className="flex flex-wrap items-center justify-between gap-2">
+ <p className="text-[11px] text-muted-foreground">
+ {connected
+ ? account
+ ? t("ultrawiki.subscription.connected_as").replace("{0}", account)
+ : t("ultrawiki.subscription.connected")
+ : status?.installed === false
+ ? t("ultrawiki.subscription.cli_missing")
+ : statusError
+ ? t("ultrawiki.subscription.status_unavailable")
+ : t("ultrawiki.subscription.not_connected")}
+ </p>
+ {connected ? (
+ <Button
+ size="sm"
+ variant="outline"
+ disabled={pending}
+ onClick={() => void disconnect()}
+ className="h-7 gap-1.5 text-xs"
+ data-testid={`ultrawiki-subscription-disconnect-${authMode}`}
+ >
+ {pending ? (
+ <Loader2 className="h-3.5 w-3.5 animate-spin" />
+ ) : (
+ <LogOut className="h-3.5 w-3.5" />
+ )}
+ {t("ultrawiki.subscription.disconnect")}
+ </Button>
+ ) : (
+ <Button
+ size="sm"
+ variant="secondary"
+ disabled={pending || status?.installed === false}
+ onClick={() => void connect()}
+ className="h-7 gap-1.5 text-xs"
+ data-testid={`ultrawiki-subscription-connect-${authMode}`}
+ >
+ {pending ? (
+ <Loader2 className="h-3.5 w-3.5 animate-spin" />
+ ) : (
+ <LogIn className="h-3.5 w-3.5" />
+ )}
+ {t("ultrawiki.subscription.connect")}
+ </Button>
+ )}
+ </div>
+ </div>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.json
index 87ae325715..be4bf0e2a5 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json
@@ -3088,7 +3088,23 @@
"auth_none": "Keine Zugangsdaten nötig",
"auth_api_key": "API-Schlüssel",
"auth_connection_string": "Verbindungszeichenfolge",
- "auth_managed_link": "Geführte Anmeldung"
+ "auth_managed_link": "Geführte Anmeldung",
+ "auth_codex": "ChatGPT-Subscription-Anmeldung",
+ "auth_antigravity": "Google-Subscription-Anmeldung",
+ "auth_claude_cli": "Claude-Subscription-Anmeldung"
+ },
+ "subscription": {
+ "connected": "Subscription verbunden",
+ "connected_as": "Verbunden als {0}",
+ "not_connected": "Subscription-Anmeldung nicht verbunden",
+ "cli_missing": "Die benötigte CLI ist nicht installiert",
+ "status_unavailable": "Anmeldestatus ist nicht verfügbar",
+ "connect": "Verbinden",
+ "disconnect": "Trennen",
+ "login_started": "Anmeldung gestartet — im Browser- oder Terminalfenster abschließen",
+ "login_failed": "Anmeldung konnte nicht gestartet werden: {0}",
+ "disconnected": "Subscription getrennt",
+ "disconnect_failed": "Subscription konnte nicht getrennt werden: {0}"
},
"supabase": {
"step1_title": "1. Bei Supabase anmelden",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.json
index 46765c37f2..e7d33882c0 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json
@@ -3074,7 +3074,23 @@
"auth_none": "No credential needed",
"auth_api_key": "API key",
"auth_connection_string": "Connection string",
- "auth_managed_link": "Guided sign-in"
+ "auth_managed_link": "Guided sign-in",
+ "auth_codex": "ChatGPT subscription login",
+ "auth_antigravity": "Google subscription login",
+ "auth_claude_cli": "Claude subscription login"
+ },
+ "subscription": {
+ "connected": "Subscription connected",
+ "connected_as": "Connected as {0}",
+ "not_connected": "Subscription login not connected",
+ "cli_missing": "The required CLI is not installed",
+ "status_unavailable": "Login status is unavailable",
+ "connect": "Connect",
+ "disconnect": "Disconnect",
+ "login_started": "Login started — finish it in the browser or terminal window",
+ "login_failed": "Could not start the login: {0}",
+ "disconnected": "Subscription disconnected",
+ "disconnect_failed": "Could not disconnect the subscription: {0}"
},
"supabase": {
"step1_title": "1. Sign in to Supabase",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.json
index 35b6631724..153ad0b8ce 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json
@@ -3073,7 +3073,23 @@
"auth_none": "No necesita credenciales",
"auth_api_key": "Clave de API",
"auth_connection_string": "Cadena de conexión",
- "auth_managed_link": "Inicio de sesión guiado"
+ "auth_managed_link": "Inicio de sesión guiado",
+ "auth_codex": "Inicio con suscripción de ChatGPT",
+ "auth_antigravity": "Inicio con suscripción de Google",
+ "auth_claude_cli": "Inicio con suscripción de Claude"
+ },
+ "subscription": {
+ "connected": "Suscripción conectada",
+ "connected_as": "Conectado como {0}",
+ "not_connected": "La suscripción no está conectada",
+ "cli_missing": "La CLI necesaria no está instalada",
+ "status_unavailable": "El estado de inicio de sesión no está disponible",
+ "connect": "Conectar",
+ "disconnect": "Desconectar",
+ "login_started": "Inicio de sesión iniciado — complétalo en el navegador o terminal",
+ "login_failed": "No se pudo iniciar sesión: {0}",
+ "disconnected": "Suscripción desconectada",
+ "disconnect_failed": "No se pudo desconectar la suscripción: {0}"
},
"supabase": {
"step1_title": "1. Inicia sesión en Supabase",
diff --git a/jarvis/ui/web/frontend/src/lib/ultrawikiApi.ts b/jarvis/ui/web/frontend/src/lib/ultrawikiApi.ts
index 648203ab71..8dab99580c 100644
--- a/jarvis/ui/web/frontend/src/lib/ultrawikiApi.ts
+++ b/jarvis/ui/web/frontend/src/lib/ultrawikiApi.ts
@@ -503,7 +503,10 @@ export type UltraWikiAuthMode =
| "none"
| "api_key"
| "connection_string"
- | "managed_link";
+ | "managed_link"
+ | "codex"
+ | "antigravity"
+ | "claude_cli";
/**
* One provider row of `GET /api/ultrawiki/catalog`: the declared spec plus the
diff --git a/jarvis/ui/web/ultrawiki_routes.py b/jarvis/ui/web/ultrawiki_routes.py
index a66bc6d869..00c7334c80 100644
--- a/jarvis/ui/web/ultrawiki_routes.py
+++ b/jarvis/ui/web/ultrawiki_routes.py
@@ -502,16 +502,26 @@ async def get_catalog(request: Request) -> dict[str, Any]:
)
from jarvis.memory.wiki.provider_chain import ( # noqa: PLC0415 — lazy
credential_ready_wiki_providers,
+ subscription_login_ready,
)
+ registry = BrainProviderRegistry()
+ available_brains = set(registry.available())
distill_chain = set(
credential_ready_wiki_providers(
- available=set(BrainProviderRegistry().available()), config=cfg
+ available=available_brains, config=cfg
)
)
+ subscription_ready = {
+ spec.id: subscription_login_ready(spec.id, registry=registry)
+ for spec in provider_catalog.DISTILL_PROVIDERS
+ if spec.auth_mode in provider_catalog.SUBSCRIPTION_AUTH_MODES
+ and spec.id in available_brains
+ }
except Exception as exc: # noqa: BLE001 — the catalog must never 500
log.debug("distill chain probe failed: %s", exc, exc_info=True)
distill_chain = set()
+ subscription_ready = {}
db_url_present = _secret_present("ultrawiki_db_url")
@@ -527,6 +537,14 @@ async def get_catalog(request: Request) -> dict[str, Any]:
return False, "this backend is not installed in this build"
return bool(row.get("ready")), str(row.get("reason") or "")
if spec.slot == "distill":
+ if spec.auth_mode in provider_catalog.SUBSCRIPTION_AUTH_MODES:
+ if subscription_ready.get(spec.id) is True:
+ return True, ""
+ return False, (
+ "subscription login is not connected — connect below, "
+ "or leave the slot on Automatic to use another ready "
+ "provider"
+ )
if spec.id in distill_chain:
return True, ""
return False, (
diff --git a/jarvis/ultrawiki/distill.py b/jarvis/ultrawiki/distill.py
index 886add3316..aa0e84022b 100644
--- a/jarvis/ultrawiki/distill.py
+++ b/jarvis/ultrawiki/distill.py
@@ -221,6 +221,18 @@ async def distill_text(
configured_provider = str(getattr(ultrawiki, "distill_provider", "") or "").strip()
configured_model = str(getattr(ultrawiki, "distill_model", "") or "").strip()
+ # The Codex subscription and OpenAI API are intentionally separate cards.
+ # The shared Codex brain normally prefers a stored API key, so the
+ # subscription auth capability must ride into this explicitly selected
+ # instance or the UI would claim one billing path while using another.
+ provider_options: dict[str, dict[str, Any]] = {}
+ if configured_provider:
+ from jarvis.ultrawiki.provider_catalog import get_provider_spec
+
+ selected_spec = get_provider_spec("distill", configured_provider)
+ if selected_spec is not None and selected_spec.auth_mode == "codex":
+ provider_options[configured_provider] = {"prefer_subscription": True}
+
available = set(registry.available())
credential_ready = credential_ready_wiki_providers(available=available, config=cfg)
@@ -258,6 +270,7 @@ async def distill_text(
label="UltraWikiDistiller",
aggregate=aggregate,
validate=_validate_distill_response,
+ provider_options=provider_options,
)
if result is None:
raise DistillError(
diff --git a/jarvis/ultrawiki/provider_catalog.py b/jarvis/ultrawiki/provider_catalog.py
index 8a7795875b..d46d9398c8 100644
--- a/jarvis/ultrawiki/provider_catalog.py
+++ b/jarvis/ultrawiki/provider_catalog.py
@@ -40,6 +40,7 @@ __all__ = [
"SlotName",
"UltraWikiAuthMode",
"UltraWikiProviderSpec",
+ "SUBSCRIPTION_AUTH_MODES",
"SLOT_NAMES",
"STORAGE_PROVIDERS",
"EMBEDDING_PROVIDERS",
@@ -60,7 +61,22 @@ SlotName = Literal["storage", "embedding", "distill", "rerank"]
#: ``connection_string`` — one secret slot holds a full Postgres URI.
#: ``managed_link`` — a guided flow assembles the credential for the user
#: (Supabase: browser login → project pick → password).
-UltraWikiAuthMode = Literal["none", "api_key", "connection_string", "managed_link"]
+UltraWikiAuthMode = Literal[
+ "none",
+ "api_key",
+ "connection_string",
+ "managed_link",
+ "codex",
+ "antigravity",
+ "claude_cli",
+]
+
+# Subscription auth modes mirror the established API-Keys/Jarvis-Agent
+# provider descriptors. They are capability labels: callers branch on the
+# login mechanism, never on a vendor or model name (AP-21).
+SUBSCRIPTION_AUTH_MODES: frozenset[str] = frozenset(
+ {"codex", "antigravity", "claude_cli"}
+)
SLOT_NAMES: tuple[SlotName, ...] = ("storage", "embedding", "distill", "rerank")
@@ -345,6 +361,43 @@ RERANK_MODEL_IS_USER_CHOSEN = False
# lets the chain pick, which is the honest default.
DISTILL_PROVIDERS: tuple[UltraWikiProviderSpec, ...] = (
+ UltraWikiProviderSpec(
+ id="codex",
+ slot="distill",
+ label="OpenAI Codex (ChatGPT subscription)",
+ auth_mode="codex",
+ secret_keys=(),
+ dashboard_url="https://chatgpt.com/",
+ credential_help=(
+ "Uses your existing ChatGPT/Codex login through the Codex CLI. "
+ "This card never needs an OpenAI API key; usage counts against "
+ "your subscription limits."
+ ),
+ ),
+ UltraWikiProviderSpec(
+ id="antigravity",
+ slot="distill",
+ label="Antigravity (Google subscription)",
+ auth_mode="antigravity",
+ secret_keys=(),
+ dashboard_url="https://antigravity.google/",
+ credential_help=(
+ "Uses your Google subscription through the Antigravity or Gemini "
+ "CLI login. This card does not use the Gemini API key."
+ ),
+ ),
+ UltraWikiProviderSpec(
+ id="claude-cli",
+ slot="distill",
+ label="Claude (Anthropic subscription)",
+ auth_mode="claude_cli",
+ secret_keys=(),
+ dashboard_url="https://claude.ai/",
+ credential_help=(
+ "Uses your Claude subscription through the Claude CLI login. "
+ "This card does not use an Anthropic API key."
+ ),
+ ),
UltraWikiProviderSpec(
id="gemini",
slot="distill",
diff --git a/tests/unit/memory/wiki/test_provider_chain.py b/tests/unit/memory/wiki/test_provider_chain.py
index 183d220b4b..c26e2870c6 100644
--- a/tests/unit/memory/wiki/test_provider_chain.py
+++ b/tests/unit/memory/wiki/test_provider_chain.py
@@ -118,7 +118,9 @@ def test_keyless_codex_subscription_keeps_the_wiki_working(
monkeypatch.setattr(
codex_auth,
"CodexAuthService",
- lambda: NS(status=lambda: NS(installed=True, connected=True)),
+ lambda: NS(
+ status=lambda: NS(installed=True, connected=True, mode="chatgpt")
+ ),
)
ready = credential_ready_wiki_providers(
available={"codex"},
@@ -127,6 +129,31 @@ def test_keyless_codex_subscription_keeps_the_wiki_working(
assert ready == {"codex"} # ChatGPT login counts, no API key needed
+def test_disconnected_claude_subscription_is_excluded_from_the_chain(
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ from types import SimpleNamespace as NS
+
+ import jarvis.claude_auth as claude_auth
+ from jarvis.core import config as config_module
+
+ monkeypatch.setattr(
+ config_module,
+ "resolve_provider_endpoint",
+ lambda provider, config: NS(credential=None),
+ )
+ monkeypatch.setattr(
+ claude_auth,
+ "ClaudeAuthService",
+ lambda: NS(status=lambda: NS(installed=True, connected=False)),
+ )
+ ready = credential_ready_wiki_providers(
+ available={"claude-cli"},
+ config=object(),
+ )
+ assert ready == set()
+
+
def test_credential_probe_uses_core_portable_storage_and_keeps_oauth(
monkeypatch: pytest.MonkeyPatch,
) -> None:
diff --git a/tests/unit/plugins/brain/test_claude_cli_brain.py b/tests/unit/plugins/brain/test_claude_cli_brain.py
index e86bbba238..0df4458db6 100644
--- a/tests/unit/plugins/brain/test_claude_cli_brain.py
+++ b/tests/unit/plugins/brain/test_claude_cli_brain.py
@@ -91,6 +91,20 @@ def test_subscription_probe_never_raises(monkeypatch: pytest.MonkeyPatch) -> Non
assert ClaudeCliBrain.subscription_connected() is False
+def test_api_key_login_does_not_masquerade_as_a_subscription(
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ from types import SimpleNamespace
+
+ monkeypatch.setattr(
+ "jarvis.claude_auth.ClaudeAuthService",
+ lambda: SimpleNamespace(
+ status=lambda: SimpleNamespace(connected=True, mode="api_key")
+ ),
+ )
+ assert ClaudeCliBrain.subscription_connected() is False
+
+
async def test_complete_raises_a_clear_error_when_the_cli_is_absent(
monkeypatch: pytest.MonkeyPatch,
) -> None:
diff --git a/tests/unit/plugins/brain/test_codex_brain.py b/tests/unit/plugins/brain/test_codex_brain.py
index 6355b68f96..48bc5a0beb 100644
--- a/tests/unit/plugins/brain/test_codex_brain.py
+++ b/tests/unit/plugins/brain/test_codex_brain.py
@@ -16,7 +16,7 @@ import pytest
from jarvis.core.protocols import BrainDelta, BrainMessage, BrainRequest
from jarvis.plugins.brain import codex as codex_module
-from jarvis.plugins.brain.codex import CodexBrain
+from jarvis.plugins.brain.codex import CodexBrain, _build_cli_command
def _wiki_request() -> BrainRequest:
@@ -98,6 +98,56 @@ async def test_throttled_api_key_crosses_over_to_the_subscription_cli(
assert calls == ["cli"]
+async def test_explicit_subscription_choice_bypasses_a_stored_api_key(
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ brain = CodexBrain(prefer_subscription=True)
+ calls = _arm_api_and_oauth(monkeypatch, brain, status=500)
+
+ answer = await _collect(brain.complete(_wiki_request()))
+
+ assert answer == "cli-answer"
+ assert calls == ["cli"]
+
+
+def test_subscription_cli_command_carries_the_selected_model() -> None:
+ argv = _build_cli_command("codex", "gpt-5.6-sol")
+
+ assert argv[argv.index("--model") + 1] == "gpt-5.6-sol"
+
+
+def test_subscription_cli_command_omits_an_unpinned_model() -> None:
+ assert "--model" not in _build_cli_command("codex", "")
+
+
+def test_forced_subscription_reports_only_its_actual_capabilities(
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ monkeypatch.setattr(CodexBrain, "_api_key", lambda self: "sk-test")
+
+ brain = CodexBrain(prefer_subscription=True)
+
+ assert brain.supports_vision is False
+ assert brain.can_call_tools() is False
+
+
+async def test_forced_subscription_rejects_tool_turns(
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ brain = CodexBrain(prefer_subscription=True)
+ calls = _arm_api_and_oauth(monkeypatch, brain, status=500)
+ request = BrainRequest(
+ messages=(BrainMessage(role="user", content="Open the calculator."),),
+ tools=({"name": "open_app"},),
+ )
+
+ with pytest.raises(RuntimeError, match="cannot execute brain tools"):
+ await _collect(brain.complete(request))
+ assert calls == []
+
+
@pytest.mark.asyncio
async def test_partial_tool_call_stream_never_crosses_over(
monkeypatch: pytest.MonkeyPatch,
diff --git a/tests/unit/ultrawiki/test_distill.py b/tests/unit/ultrawiki/test_distill.py
index f065d27469..31f2ebd907 100644
--- a/tests/unit/ultrawiki/test_distill.py
+++ b/tests/unit/ultrawiki/test_distill.py
@@ -178,6 +178,19 @@ async def test_configured_distill_provider_leads_the_chain(chain_env):
assert chain_env["model_override"] == "gpt-cheap"
+async def test_codex_subscription_card_forces_the_subscription_auth_path(chain_env):
+ chain_env["script"](GOOD_JSON)
+
+ await distill_text(
+ _cfg(distill_provider="codex", distill_model="gpt-5.6-luna"),
+ title="t", body="b", source_kind="chat", registry=FakeRegistry(),
+ )
+
+ assert chain_env["provider_options"] == {
+ "codex": {"prefer_subscription": True}
+ }
+
+
async def test_unset_distill_provider_falls_back_to_brain_primary(chain_env):
chain_env["script"](GOOD_JSON)
diff --git a/tests/unit/ultrawiki/test_provider_catalog.py b/tests/unit/ultrawiki/test_provider_catalog.py
index 2a636142d0..b1e94b3019 100644
--- a/tests/unit/ultrawiki/test_provider_catalog.py
+++ b/tests/unit/ultrawiki/test_provider_catalog.py
@@ -8,6 +8,11 @@ to render must be a slot the secrets API will actually accept.
from __future__ import annotations
+import json
+import re
+from pathlib import Path
+from typing import get_args
+
import pytest
from jarvis.core.config_writer import ULTRAWIKI_SLOT_KEYS
@@ -16,6 +21,8 @@ from jarvis.ultrawiki import embeddings as embeddings_mod
from jarvis.ultrawiki import provider_catalog as catalog
from jarvis.ultrawiki import rerank as rerank_mod
+_ROOT = Path(__file__).resolve().parents[3]
+
def test_every_catalog_secret_slot_is_writable_through_the_secrets_api():
"""A rendered key field the API refuses to save is a dead end.
@@ -72,7 +79,53 @@ def test_a_credentialed_provider_always_names_its_secret_slot():
if spec.auth_mode in ("api_key", "connection_string", "managed_link"):
assert spec.secret_keys, f"{slot}/{spec.id} declares no secret slot"
else:
- assert spec.auth_mode == "none"
+ assert spec.auth_mode == "none" or (
+ spec.auth_mode in catalog.SUBSCRIPTION_AUTH_MODES
+ and not spec.secret_keys
+ )
+
+
+def test_distillation_exposes_every_subscription_brain_as_its_own_card():
+ subscription_rows = {
+ spec.id: spec.auth_mode
+ for spec in catalog.DISTILL_PROVIDERS
+ if spec.auth_mode in catalog.SUBSCRIPTION_AUTH_MODES
+ }
+ assert subscription_rows == {
+ "codex": "codex",
+ "antigravity": "antigravity",
+ "claude-cli": "claude_cli",
+ }
+
+
+def test_auth_modes_match_typescript_and_the_ui_labels():
+ """Python producer, TypeScript consumer, and UI labels stay in lockstep."""
+ python_modes = set(get_args(catalog.UltraWikiAuthMode))
+ api_source = (
+ _ROOT
+ / "jarvis/ui/web/frontend/src/lib/ultrawikiApi.ts"
+ ).read_text(encoding="utf-8")
+ block = re.search(
+ r"export type UltraWikiAuthMode\s*=\s*(.*?);",
+ api_source,
+ re.DOTALL,
+ )
+ assert block is not None
+ typescript_modes = set(re.findall(r'"([a-z_]+)"', block.group(1)))
+
+ english = json.loads(
+ (
+ _ROOT
+ / "jarvis/ui/web/frontend/src/i18n/locales/en.json"
+ ).read_text(encoding="utf-8")
+ )
+ label_modes = {
+ key.removeprefix("auth_")
+ for key in english["ultrawiki"]["card"]
+ if key.startswith("auth_")
+ }
+
+ assert python_modes == typescript_modes == label_modes
def test_storage_presets_resolve_to_the_two_functional_backends_only():
diff --git a/tests/unit/web/test_ultrawiki_routes.py b/tests/unit/web/test_ultrawiki_routes.py
index 3c1d9d3a5d..02d1f1fed2 100644
--- a/tests/unit/web/test_ultrawiki_routes.py
+++ b/tests/unit/web/test_ultrawiki_routes.py
@@ -845,6 +845,28 @@ def test_catalog_marks_the_configured_provider_as_selected(env) -> None:
assert body["models"]["embedding"] == "fake-embed"
+def test_catalog_surfaces_subscription_logins_as_distillation_choices(
+ env, monkeypatch
+) -> None:
+ from jarvis.memory.wiki import provider_chain
+
+ monkeypatch.setattr(
+ provider_chain,
+ "subscription_login_ready",
+ lambda provider, *, registry=None: provider in {"codex", "claude-cli"},
+ )
+
+ rows = {
+ row["id"]: row
+ for row in env.client.get("/api/ultrawiki/catalog").json()["slots"]["distill"]
+ }
+ assert {"codex", "antigravity", "claude-cli"} <= set(rows)
+ assert rows["codex"]["auth_mode"] == "codex"
+ assert rows["codex"]["ready"] is True
+ assert rows["antigravity"]["ready"] is False
+ assert "subscription login" in rows["antigravity"]["reason"]
+
+
def test_catalog_storage_defaults_to_the_local_floor(env) -> None:
body = env.client.get("/api/ultrawiki/catalog").json()
storage = {row["id"]: row for row in body["slots"]["storage"]}