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(settings): redesign the API Keys page without boxes

rubenluetke10-beep2577d1fe87e4
diff --git a/jarvis/ui/web/frontend/src/components/PromptWriterCard.tsx b/jarvis/ui/web/frontend/src/components/PromptWriterCard.tsx
index 243d5a5525..ca1583d6fc 100644
--- a/jarvis/ui/web/frontend/src/components/PromptWriterCard.tsx
+++ b/jarvis/ui/web/frontend/src/components/PromptWriterCard.tsx
@@ -86,7 +86,7 @@ export function PromptWriterCard() {
if (loading) {
return (
- <div className="card-outline flex items-center gap-2 p-4 text-xs text-muted-foreground">
+ <div className="flex items-center gap-2 text-sm text-muted-foreground">
<Loader2 className="h-3.5 w-3.5 animate-spin" />
{t("prompt_writer.loading")}
</div>
@@ -98,15 +98,15 @@ export function PromptWriterCard() {
const clis = options.filter((o) => !MODE_IDS.has(o.id));
return (
- <div className="card-outline space-y-3 p-4" data-testid="prompt-writer-card">
+ <div className="space-y-3" data-testid="prompt-writer-card">
<div className="space-y-1">
- <h4 className="text-xs font-medium">{t("prompt_writer.title")}</h4>
- <p className="text-xs leading-relaxed text-muted-foreground">
+ <h4 className="text-sm font-medium">{t("prompt_writer.title")}</h4>
+ <p className="text-sm text-muted-foreground">
{t("prompt_writer.description")}
</p>
</div>
- <div className="space-y-2">
+ <div className="space-y-0.5">
{modes.map((option) => (
<WriterRow
key={option.id}
@@ -120,8 +120,8 @@ export function PromptWriterCard() {
</div>
{clis.length > 0 && (
- <div className="space-y-2">
- <p className="px-1 text-micro uppercase tracking-wider text-muted-foreground">
+ <div className="space-y-0.5">
+ <p className="px-2 pb-1 pt-2 text-xs text-muted-foreground">
{t("prompt_writer.connected_clis")}
</p>
{clis.map((option) => (
@@ -182,15 +182,13 @@ function WriterRow({
disabled={blocked || disabled}
onClick={() => onSelect(option.id)}
className={cn(
- "flex w-full items-center gap-2.5 rounded-lg border px-3 py-2 text-left transition",
- selected
- ? "border-primary/60 bg-primary/5"
- : "border-border hover:border-primary/40",
- blocked && "cursor-not-allowed opacity-50 hover:border-border",
+ "flex w-full items-center gap-2.5 rounded-md px-2 py-1.5 text-left transition-colors",
+ selected ? "bg-secondary text-foreground" : "text-muted-foreground hover:bg-secondary/50 hover:text-foreground",
+ blocked && "cursor-not-allowed opacity-50 hover:bg-transparent",
)}
>
<Icon className="h-3.5 w-3.5 shrink-0 text-muted-foreground" />
- <span className="min-w-0 flex-1 text-xs leading-snug">
+ <span className="min-w-0 flex-1 text-sm leading-snug">
<span className="block truncate">{option.label}</span>
{blocked && (
<span className="block text-micro text-muted-foreground">
diff --git a/jarvis/ui/web/frontend/src/components/SubagentModelCard.tsx b/jarvis/ui/web/frontend/src/components/SubagentModelCard.tsx
index 7993605fd6..c2a0da2ba4 100644
--- a/jarvis/ui/web/frontend/src/components/SubagentModelCard.tsx
+++ b/jarvis/ui/web/frontend/src/components/SubagentModelCard.tsx
@@ -83,8 +83,9 @@ export function SubagentModelCard({
(p) => p.id === catalogProvider && p.supports_model_pull,
);
return (
- <div className="space-y-3 rounded-surface border border-border bg-card p-3.5">
- <p className="text-xs leading-relaxed text-muted-foreground">
+ <div className="space-y-3" data-testid="subagent-model-card">
+ <h4 className="text-sm font-medium">{t("subagent_model.model_label")}</h4>
+ <p className="text-sm text-muted-foreground">
{t("subagent_model.description")}
</p>
{catalogProvider ? (
diff --git a/jarvis/ui/web/frontend/src/components/providers/LiveProfile.test.tsx b/jarvis/ui/web/frontend/src/components/providers/LiveProfile.test.tsx
index d4cbf77f77..1f83f75e3e 100644
--- a/jarvis/ui/web/frontend/src/components/providers/LiveProfile.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/providers/LiveProfile.test.tsx
@@ -53,7 +53,8 @@ it("requires an explicit thinking model and sends one coherent selection", async
);
const button = await screen.findByRole("button", { name: "live.save" });
expect((button as HTMLButtonElement).disabled).toBe(true);
- fireEvent.click(await screen.findByRole("radio", { name: /Chosen/ }));
+ fireEvent.click(screen.getByRole("combobox", { name: "live.thinking_model" }));
+ fireEvent.click(await screen.findByRole("option", { name: /Chosen/ }));
fireEvent.click(button);
await waitFor(() => expect(requests).toHaveLength(1));
expect(requests[0]).toMatchObject({
@@ -86,12 +87,13 @@ it("recognizes a newly connected key without losing the user's model choice", as
const client = new QueryClient({ defaultOptions: { queries: { retry: false } } });
render(<QueryClientProvider client={client}><LiveProfile /></QueryClientProvider>);
const button = await screen.findByRole("button", { name: "live.save" });
- fireEvent.click(await screen.findByRole("radio", { name: /Chosen/ }));
+ fireEvent.click(screen.getByRole("combobox", { name: "live.thinking_model" }));
+ fireEvent.click(await screen.findByRole("option", { name: /Chosen/ }));
expect((button as HTMLButtonElement).disabled).toBe(true);
keyReady = true;
fireEvent(window, new CustomEvent("jarvis:secret-configured"));
await waitFor(() => expect((button as HTMLButtonElement).disabled).toBe(false));
- expect(screen.getByRole("radio", { name: /Chosen/ }).getAttribute("aria-checked")).toBe("true");
+ expect(screen.getByRole("combobox", { name: "live.thinking_model" }).textContent).toContain("Chosen");
client.clear();
});
@@ -118,7 +120,8 @@ it("applies a new thinking model at once when Live is already set up", async ()
);
const client = new QueryClient({ defaultOptions: { queries: { retry: false } } });
render(<QueryClientProvider client={client}><LiveProfile /></QueryClientProvider>);
- fireEvent.click(await screen.findByRole("radio", { name: /Cheap/ }));
+ fireEvent.click(await screen.findByRole("combobox", { name: "live.thinking_model" }));
+ fireEvent.click(await screen.findByRole("option", { name: /Cheap/ }));
await waitFor(() => expect(requests).toHaveLength(1));
expect(requests[0]).toMatchObject({ backend_model: "cheap-model", configured: true });
client.clear();
@@ -177,8 +180,9 @@ it("keeps hosted web search editable only for API mode and preserves its setting
await selectSubscription();
await screen.findByText("live.subscription_connected");
expect(screen.queryByRole("switch", { name: "live.web_search" })).toBeNull();
- await waitFor(() => expect((screen.getByRole("radio", { name: /Subscription model/ }) as HTMLButtonElement).disabled).toBe(false));
- fireEvent.click(await screen.findByRole("radio", { name: /Subscription model/ }));
+ await waitFor(() => expect((screen.getByRole("combobox", { name: "live.thinking_model" }) as HTMLButtonElement).disabled).toBe(false));
+ fireEvent.click(screen.getByRole("combobox", { name: "live.thinking_model" }));
+ fireEvent.click(await screen.findByRole("option", { name: /Subscription model/ }));
fireEvent.click(screen.getByRole("button", { name: "live.save" }));
await waitFor(() => expect(writes).toHaveLength(1));
expect(writes[0].web_search).toBe(false);
@@ -191,7 +195,7 @@ it("opens a dedicated subscription row in its own mode without rewriting the sto
const { client, writes, onAuthModeChange } = subscriptionSetup({ selectedAuthMode: "chatgpt_subscription" });
await screen.findByText("live.subscription_connected");
expect(screen.queryByRole("radiogroup", { name: "live.billing_method" })).toBeNull();
- expect(screen.getByText("GPT Subscription")).toBeTruthy();
+ expect(screen.getByText("providers_page.access_subscription")).toBeTruthy();
await waitFor(() => expect(screen.getByRole("combobox", { name: "live.voice" }).textContent).toContain("Cove"));
expect(onAuthModeChange).toHaveBeenLastCalledWith("chatgpt_subscription", true);
expect(writes).toHaveLength(0);
@@ -206,9 +210,10 @@ it("saves subscription voice without an API key and preserves the complete API s
expect(screen.getByText("live.subscription_voice_unverified")).toBeTruthy();
expect(screen.queryByText("live.key_required")).toBeNull();
expect(screen.queryByRole("button", { name: "live.use_for_agents" })).toBeNull();
- await waitFor(() => expect((screen.getByRole("radio", { name: /Subscription model/ }) as HTMLButtonElement).disabled).toBe(false));
- expect(screen.queryByRole("radio", { name: /API model/ })).toBeNull();
- fireEvent.click(await screen.findByRole("radio", { name: /Subscription model/ }));
+ await waitFor(() => expect((screen.getByRole("combobox", { name: "live.thinking_model" }) as HTMLButtonElement).disabled).toBe(false));
+ fireEvent.click(screen.getByRole("combobox", { name: "live.thinking_model" }));
+ expect(screen.queryByRole("option", { name: /API model/ })).toBeNull();
+ fireEvent.click(await screen.findByRole("option", { name: /Subscription model/ }));
expect(writes).toHaveLength(0);
expect(onAuthModeChange).toHaveBeenLastCalledWith("chatgpt_subscription", true);
fireEvent.click(screen.getByRole("button", { name: "live.save" }));
@@ -223,7 +228,7 @@ it("saves subscription voice without an API key and preserves the complete API s
expect(onAuthModeChange).toHaveBeenLastCalledWith("chatgpt_subscription", false);
fireEvent.click(screen.getByRole("radio", { name: "providers_page.access_api_key" }));
expect(screen.getByRole("combobox", { name: "live.voice" }).textContent).toContain("Gleam");
- expect(screen.getByRole("radio", { name: /API model/ }).getAttribute("aria-checked")).toBe("true");
+ expect(screen.getByRole("combobox", { name: "live.thinking_model" }).textContent).toContain("API model");
expect((screen.getByRole("button", { name: "live.save" }) as HTMLButtonElement).disabled).toBe(true);
expect(writes).toHaveLength(1);
client.clear();
@@ -243,8 +248,9 @@ it("does not treat a Codex API-key login as a ChatGPT subscription", async () =>
it("offers only the selected subscription model's advertised reasoning levels", async () => {
const { client, writes } = subscriptionSetup({ modelEfforts: ["low", "high", "max"] });
await selectSubscription();
- await waitFor(() => expect((screen.getByRole("radio", { name: /Subscription model/ }) as HTMLButtonElement).disabled).toBe(false));
- fireEvent.click(await screen.findByRole("radio", { name: /Subscription model/ }));
+ await waitFor(() => expect((screen.getByRole("combobox", { name: "live.thinking_model" }) as HTMLButtonElement).disabled).toBe(false));
+ fireEvent.click(screen.getByRole("combobox", { name: "live.thinking_model" }));
+ fireEvent.click(await screen.findByRole("option", { name: /Subscription model/ }));
expect(screen.getByRole("combobox", { name: "live.reasoning" }).textContent).toContain("live.model_default");
fireEvent.click(screen.getByRole("combobox", { name: "live.reasoning" }));
expect(screen.queryByRole("option", { name: "Medium" })).toBeNull();
@@ -261,7 +267,7 @@ it("keeps subscription selection when its catalog fails instead of using API opt
const { client, writes } = subscriptionSetup({ catalogFails: true });
await selectSubscription();
await screen.findByText("live.options_failed");
- expect(screen.queryByTestId("live-thinking-models")).toBeNull();
+ expect((screen.getByRole("combobox", { name: "live.thinking_model" }) as HTMLButtonElement).disabled).toBe(true);
expect((screen.getByRole("button", { name: "live.save" }) as HTMLButtonElement).disabled).toBe(true);
expect(screen.getByRole("radio", { name: "providers_page.access_subscription" }).getAttribute("aria-checked")).toBe("true");
expect(writes).toHaveLength(0);
diff --git a/jarvis/ui/web/frontend/src/components/providers/LiveProfile.tsx b/jarvis/ui/web/frontend/src/components/providers/LiveProfile.tsx
index 1287ec5ccd..81461a6b89 100644
--- a/jarvis/ui/web/frontend/src/components/providers/LiveProfile.tsx
+++ b/jarvis/ui/web/frontend/src/components/providers/LiveProfile.tsx
@@ -1,13 +1,14 @@
import { useEffect, useState, type ReactNode } from "react";
import { useQuery, useQueryClient } from "@tanstack/react-query";
-import { Check, ChevronRight, Loader2 } from "lucide-react";
+import { Loader2 } from "lucide-react";
import { useT } from "@/i18n";
import { Button } from "@/components/ui/button";
import { BrandedSelect } from "@/components/ui/select";
import { Switch } from "@/components/ui/switch";
import { Textarea } from "@/components/ui/textarea";
import { Input } from "@/components/ui/input";
-import { ModelList, ModelListRow, Segmented, SettingsRow, SettingsSection } from "@/views/apikeys/settingsUi";
+import { Choice, Disclosure, Row, Rows, StatusLine } from "@/views/apikeys/ledger";
+import { ProviderLogo } from "./ProviderLogo";
import { fetchAgentAccounts } from "@/lib/agentAccountsApi";
import { LiveSubscriptionAccount } from "./LiveSubscriptionAccount";
import { useRestartApp } from "@/hooks/useRestartApp";
@@ -255,196 +256,199 @@ export function LiveProfile({ onSaved, onAuthModeChange, selectedAuthMode, keyFi
// "Saved & active" button read as a broken control; the saved state is a
// quiet line instead.
const showSave = !ready || dirty;
+ const statusTone = billingPending ? "warn" : ready && !dirty ? "ok" : credentialReady ? "warn" : "off";
+ const statusText = billingPending
+ ? t("live.billing_pending")
+ : ready && !dirty
+ ? t("live.ready")
+ : credentialReady
+ ? t("providers_page.voice_save_hint")
+ : t(subscription ? "live.subscription_sign_in" : "live.key_required");
return (
- <section aria-label="GPT-Live" className="flex flex-col gap-8" data-testid="live-profile">
- <SettingsSection
- title={t("live.billing_method")}
- headerAction={billingPending
- ? <span className="text-xs text-muted-foreground">{t("live.billing_pending")}</span>
- : ready && !dirty ? (
- <span data-testid="live-profile-saved" className="inline-flex items-center gap-1.5 text-xs text-muted-foreground">
- <Check aria-hidden="true" className="h-3.5 w-3.5 text-accent" />
- {t("live.ready")}
- </span>
- ) : undefined}
- >
- <SettingsRow
- title={t("providers_page.access_title")}
- description={t(subscription ? "live.subscription_billing" : "live.billing")}
- control={selectedAuthMode
- ? <span className="text-sm font-medium text-foreground">{subscription ? "GPT Subscription" : t("live.api_key_mode")}</span>
- : <Segmented<LiveAuthMode> value={authMode} disabled={saving}
+ <section
+ aria-label="GPT-Live"
+ data-testid="live-profile"
+ className="grid gap-x-16 gap-y-10 lg:grid-cols-[minmax(0,22rem)_minmax(0,1fr)]"
+ >
+ {/* Left: what the voice is, whether it is ready, and how it is paid. */}
+ <div className="min-w-0 lg:sticky lg:top-0 lg:self-start">
+ <div className="flex items-center gap-3">
+ <ProviderLogo providerId="openai-live" label="OpenAI" className="h-11 w-11" />
+ <div className="min-w-0">
+ <h2 className="text-lg font-semibold text-foreground-strong">GPT-Live</h2>
+ <p className="text-sm text-muted-foreground">OpenAI</p>
+ </div>
+ </div>
+ <p className="mt-4 text-sm text-muted-foreground">{t("live.conversation_help")}</p>
+ <div className="mt-3" data-testid={ready && !dirty ? "live-profile-saved" : "live-profile-status"}>
+ <StatusLine tone={statusTone}>{statusText}</StatusLine>
+ </div>
+
+ <div className="mt-8">
+ <div className="flex items-center justify-between gap-4">
+ <span className="text-sm font-medium text-foreground">{t("providers_page.access_title")}</span>
+ {selectedAuthMode ? (
+ <span className="text-sm text-muted-foreground">
+ {subscription ? t("providers_page.access_subscription") : t("providers_page.access_api_key")}
+ </span>
+ ) : (
+ <Choice<LiveAuthMode>
+ value={authMode}
+ disabled={saving}
label={t("live.billing_method")}
testId="live-access"
onChange={(mode) => update({ auth_mode: mode })}
options={[
{ value: "chatgpt_subscription", label: t("providers_page.access_subscription") },
{ value: "api_key", label: t("providers_page.access_api_key") },
- ]} />}
- />
- {!subscription && keyField}
- {subscription && !supportsSubscription ? (
- <SettingsRow
- title={t("live.subscription_mode")}
- description={t("settings_view.wake_word.restart_required")}
- control={<Button size="sm" disabled={restart.restarting} onClick={() => void restart.restart()}>{restart.buttonLabel}</Button>}
- />
- ) : null}
- {subscription && supportsSubscription ? (
- <SettingsRow title={t("live.subscription_mode")}>
- <LiveSubscriptionAccount group={group} accountId={value.subscription_account_id ?? ""}
- loading={accounts.isPending} disabled={saving}
- voiceStatus={profile.data?.subscription?.account_id === accountId
- ? profile.data.subscription.voice_status : "unverified"}
- onAccountChange={(subscription_account_id) => update({ subscription_account_id })}
- onConnected={() => {
- void queryClient.invalidateQueries({ queryKey: ["live-subscription-accounts"] });
- void queryClient.invalidateQueries({ queryKey: ["live-profile"] });
- void queryClient.invalidateQueries({ queryKey: ["live-options", "chatgpt_subscription"] });
- }} />
- {accounts.isError ? <p role="alert" className="mt-2 text-xs text-destructive">{t("live.subscription_accounts_failed")}</p> : null}
- </SettingsRow>
- ) : null}
- </SettingsSection>
+ ]}
+ />
+ )}
+ </div>
+ <p className="mt-2 text-sm text-muted-foreground">
+ {t(subscription ? "live.subscription_billing" : "live.billing")}
+ </p>
+ <div className="mt-4">
+ {!subscription && keyField}
+ {subscription && !supportsSubscription ? (
+ <div className="flex items-center justify-between gap-4 py-2">
+ <p className="text-sm text-muted-foreground">{t("settings_view.wake_word.restart_required")}</p>
+ <Button size="sm" disabled={restart.restarting} onClick={() => void restart.restart()}>{restart.buttonLabel}</Button>
+ </div>
+ ) : null}
+ {subscription && supportsSubscription ? (
+ <>
+ <LiveSubscriptionAccount group={group} accountId={value.subscription_account_id ?? ""}
+ loading={accounts.isPending} disabled={saving}
+ voiceStatus={profile.data?.subscription?.account_id === accountId
+ ? profile.data.subscription.voice_status : "unverified"}
+ onAccountChange={(subscription_account_id) => update({ subscription_account_id })}
+ onConnected={() => {
+ void queryClient.invalidateQueries({ queryKey: ["live-subscription-accounts"] });
+ void queryClient.invalidateQueries({ queryKey: ["live-profile"] });
+ void queryClient.invalidateQueries({ queryKey: ["live-options", "chatgpt_subscription"] });
+ }} />
+ {accounts.isError ? <p role="alert" className="mt-2 text-sm text-destructive">{t("live.subscription_accounts_failed")}</p> : null}
+ </>
+ ) : null}
+ </div>
+ </div>
+ </div>
- <SettingsSection title={t("live.conversation_heading")}>
- <SettingsRow
- title={t("live.voice_model")}
- description={t("live.conversation_help")}
- control={<span className="text-sm font-medium text-foreground">{subscription ? "GPT-Live · ChatGPT" : "GPT-Live 1"}</span>}
- />
- <SettingsRow
- title={t("live.voice")}
- control={
- <BrandedSelect
- className="w-56"
- value={voice}
- disabled={saving || (subscription && !options.data)}
- onValueChange={(selected) => choose(subscription ? { subscription_voice: selected } : { voice: selected })}
- ariaLabel={t("live.voice")}
- options={(options.data?.voices ?? (subscription ? [] : [voice])).map((voice) => ({
- value: voice,
- label: capitalize(voice),
- }))}
+ {/* Right: the few things a person tunes, one line each. */}
+ <div className="min-w-0">
+ <Rows>
+ <Row
+ title={t("live.voice")}
+ description={subscription ? "GPT-Live · ChatGPT" : "GPT-Live 1"}
+ control={
+ <BrandedSelect
+ className="w-60"
+ value={voice}
+ disabled={saving || (subscription && !options.data)}
+ onValueChange={(selected) => choose(subscription ? { subscription_voice: selected } : { voice: selected })}
+ ariaLabel={t("live.voice")}
+ options={(options.data?.voices ?? (subscription ? [] : [voice])).map((voice) => ({
+ value: voice,
+ label: capitalize(voice),
+ }))}
+ />
+ }
+ />
+ <Row
+ title={t("live.thinking_model")}
+ description={t(subscription ? "live.subscription_thinking_help" : "live.thinking_help")}
+ control={
+ <BrandedSelect
+ className="w-60"
+ value={backendModel}
+ disabled={saving || (subscription && !options.data)}
+ onValueChange={chooseModel}
+ ariaLabel={t("live.thinking_model")}
+ placeholder={t("live.choose_model")}
+ searchPlaceholder={t("live.search_models")}
+ options={modelOptions}
+ />
+ }
+ />
+ <Row
+ title={t("live.reasoning")}
+ control={
+ <BrandedSelect
+ className="w-60"
+ value={reasoningEffort}
+ disabled={saving}
+ onValueChange={(selected) => choose(subscription ? { subscription_reasoning_effort: selected } : { reasoning_effort: selected })}
+ ariaLabel={t("live.reasoning")}
+ options={efforts.map((effort) => ({
+ value: effort,
+ label: effort ? capitalize(effort) : t("live.model_default"),
+ }))}
+ />
+ }
+ />
+ {!subscription && (
+ <Row
+ title={<label htmlFor="live-web-search">{t("live.web_search")}</label>}
+ description={t("live.web_search_help")}
+ control={
+ <Switch
+ id="live-web-search"
+ checked={value.web_search}
+ disabled={saving}
+ onCheckedChange={(web_search) => choose({ web_search })}
+ aria-label={t("live.web_search")}
+ />
+ }
/>
- }
- />
- </SettingsSection>
+ )}
+ </Rows>
- <SettingsSection title={t("live.thinking_model")} plain>
- <div className="space-y-2.5">
- <p className="px-1 text-xs text-muted-foreground/80">
- {t(subscription ? "live.subscription_thinking_help" : "live.thinking_help")}
- </p>
- {modelOptions.length === 0 ? (
- <div className="rounded-xl border border-border/60 bg-card/40 px-4 py-3 text-xs text-muted-foreground">
- {options.isPending && options.fetchStatus !== "idle" ? t("live.loading") : t("live.choose_model")}
+ <div className="border-t border-border/60 pt-2">
+ <Disclosure label={t("live.prompts")} testId="live-prompts">
+ <div className="grid gap-4 pb-2 md:grid-cols-2">
+ <label className="space-y-1.5">
+ <span className="block text-sm text-muted-foreground">{t("live.conversation_prompt")}</span>
+ <Textarea rows={3} value={value.instructions} onChange={(event) => update({ instructions: event.target.value })} />
+ </label>
+ <label className="space-y-1.5">
+ <span className="block text-sm text-muted-foreground">{t("live.backend_prompt")}</span>
+ <Textarea rows={3} value={value.backend_instructions} onChange={(event) => update({ backend_instructions: event.target.value })} />
+ </label>
+ {!subscription ? <label className="space-y-1.5 md:col-span-2">
+ <span className="block text-sm text-muted-foreground">{t("live.custom_model")}</span>
+ <Input value={value.backend_model} onChange={(event) => update({ backend_model: event.target.value })} />
+ </label> : null}
</div>
- ) : (
- <div role="radiogroup" aria-label={t("live.thinking_model")} data-testid="live-thinking-models">
- <ModelList header={t("providers_page.thinking_pick")}>
- {modelOptions.map((model) => (
- <ModelListRow
- key={model.value}
- name={model.label}
- id={model.hint || undefined}
- selected={model.value === backendModel}
- disabled={saving || (subscription && !options.data)}
- onClick={() => chooseModel(model.value)}
- control={model.value === backendModel
- ? <Check aria-hidden="true" className="h-4 w-4 text-accent" />
- : <span aria-hidden="true" className="h-4 w-4" />}
- />
- ))}
- </ModelList>
- </div>
- )}
+ </Disclosure>
</div>
- </SettingsSection>
-
- <SettingsSection title={t("live.thinking_heading")}>
- <SettingsRow
- title={t("live.reasoning")}
- control={
- <BrandedSelect
- className="w-56"
- value={reasoningEffort}
- disabled={saving}
- onValueChange={(selected) => choose(subscription ? { subscription_reasoning_effort: selected } : { reasoning_effort: selected })}
- ariaLabel={t("live.reasoning")}
- options={efforts.map((effort) => ({
- value: effort,
- label: effort ? capitalize(effort) : t("live.model_default"),
- }))}
- />
- }
- />
- {!subscription && <SettingsRow
- title={<label htmlFor="live-web-search">{t("live.web_search")}</label>}
- description={t("live.web_search_help")}
- control={
- <Switch
- id="live-web-search"
- checked={value.web_search}
- disabled={saving}
- onCheckedChange={(web_search) => choose({ web_search })}
- aria-label={t("live.web_search")}
- />
- }
- />}
- <details className="group">
- <summary className="flex cursor-pointer list-none items-center gap-2 px-4 py-3 text-sm font-medium text-foreground transition-colors hover:bg-secondary/50 [&::-webkit-details-marker]:hidden">
- <ChevronRight
- aria-hidden="true"
- className="h-4 w-4 text-muted-foreground transition-transform group-open:rotate-90 motion-reduce:transition-none"
- />
- {t("live.prompts")}
- </summary>
- <div className="grid gap-4 px-4 pb-4 md:grid-cols-2">
- <label className="space-y-1.5">
- <span className="block text-xs font-medium text-muted-foreground">{t("live.conversation_prompt")}</span>
- <Textarea rows={3} value={value.instructions} onChange={(event) => update({ instructions: event.target.value })} />
- </label>
- <label className="space-y-1.5">
- <span className="block text-xs font-medium text-muted-foreground">{t("live.backend_prompt")}</span>
- <Textarea rows={3} value={value.backend_instructions} onChange={(event) => update({ backend_instructions: event.target.value })} />
- </label>
- {!subscription ? <label className="space-y-1.5 md:col-span-2">
- <span className="block text-xs font-medium text-muted-foreground">{t("live.custom_model")}</span>
- <Input value={value.backend_model} onChange={(event) => update({ backend_model: event.target.value })} />
- </label> : null}
- </div>
- </details>
- </SettingsSection>
- <div className="flex flex-col gap-3 px-1">
- {options.isError ? <p role="alert" className="text-xs text-destructive">{t("live.options_failed")}</p> : null}
- {!subscription && !profile.data?.key_ready && (
- <p role="status" className="text-xs text-warning">{t("live.key_required")}</p>
- )}
- <div className="flex flex-wrap items-center justify-between gap-3">
- <p className="max-w-md text-xs text-muted-foreground">{t("live.agents_separate")}</p>
- <div className="flex items-center gap-2">
- {!subscription && sameCredentials && saved?.configured && !profile.data?.agent_configured && (
- <Button variant="outline" size="sm" disabled={saving} onClick={() => void useForAgents()}>
- {t("live.use_for_agents")}
- </Button>
- )}
- {showSave ? (
- <Button
- size="sm"
- disabled={saving || !backendModel.trim() || !credentialReady || !effortAvailable ||
- (subscription && (!options.data || options.isError || !models.some((model) => model.id === backendModel)))}
- onClick={() => void save()}
- >
- {saving && <Loader2 className="animate-spin" />}
- {ready ? t("live.save_changes") : t("live.save")}
- </Button>
- ) : null}
+ <div className="mt-6 flex flex-col gap-3">
+ {options.isError ? <p role="alert" className="text-sm text-destructive">{t("live.options_failed")}</p> : null}
+ <div className="flex flex-wrap items-center justify-between gap-3">
+ <p className="max-w-md text-sm text-muted-foreground">{t("live.agents_separate")}</p>
+ <div className="flex items-center gap-2">
+ {!subscription && sameCredentials && saved?.configured && !profile.data?.agent_configured && (
+ <Button variant="outline" size="sm" disabled={saving} onClick={() => void useForAgents()}>
+ {t("live.use_for_agents")}
+ </Button>
+ )}
+ {showSave ? (
+ <Button
+ size="sm"
+ disabled={saving || !backendModel.trim() || !credentialReady || !effortAvailable ||
+ (subscription && (!options.data || options.isError || !models.some((model) => model.id === backendModel)))}
+ onClick={() => void save()}
+ >
+ {saving && <Loader2 className="animate-spin" />}
+ {ready ? t("live.save_changes") : t("live.save")}
+ </Button>
+ ) : null}
+ </div>
</div>
+ {error && <p role="alert" className="text-sm text-destructive">{error}</p>}
+ {message && <p role="status" className="text-sm text-muted-foreground">{message}</p>}
</div>
- {error && <p role="alert" className="text-xs text-destructive">{error}</p>}
- {message && <p role="status" className="text-xs text-muted-foreground">{message}</p>}
</div>
</section>
);
diff --git a/jarvis/ui/web/frontend/src/components/providers/LiveSubscriptionAccount.tsx b/jarvis/ui/web/frontend/src/components/providers/LiveSubscriptionAccount.tsx
index c3c7cdb851..49d78b6d31 100644
--- a/jarvis/ui/web/frontend/src/components/providers/LiveSubscriptionAccount.tsx
+++ b/jarvis/ui/web/frontend/src/components/providers/LiveSubscriptionAccount.tsx
@@ -225,7 +225,7 @@ export function LiveSubscriptionAccount({
}
return (
- <div className="space-y-3 rounded-lg border border-border bg-secondary/30 p-3">
+ <div className="space-y-3">
<label className="block space-y-2 text-sm">
<span>{t("live.subscription_account")}</span>
<BrandedSelect
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/providers/de.json b/jarvis/ui/web/frontend/src/i18n/locales/providers/de.json
index e1471a6049..cf5759fc50 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/providers/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/providers/de.json
@@ -96,6 +96,9 @@
"restart_title": "Neu starten, um das Update abzuschließen",
"restart_desc": "Die neue Anbieter-Seite braucht einen Neustart des App-Hintergrunddienstes. Das dauert etwa zehn Sekunden.",
"restart_action": "Jetzt neu starten",
+ "agent_providers_desc": "Schalte jeden Anbieter ein, den deine Agenten nutzen dürfen. Öffne einen, um Abo oder Schlüssel und seine Modelle zu wählen.",
+ "agent_providers_count": "{0} aktiv",
+ "voice_save_hint": "Speichern, damit der nächste Anruf diese Einstellungen nutzt",
"tab_voice": "Live-Gespräche",
"tab_agents": "Agenten",
"subscriptions_title": "Abos",
@@ -116,7 +119,8 @@
"key_missing_short": "Kein Schlüssel",
"key_desc_short": "Ein Schlüssel für alles, was dieser Anbieter macht. Abrechnung pro Nutzung.",
"separate_title": "Eigene Schlüssel",
- "accounts_title": "Mehrere Anmeldungen pro Tool" ,
+ "accounts_title": "Mehrere Anmeldungen pro Tool"
+,
"agent_providers_title": "Anbieter",
"access_title": "Zugang",
"access_desc": "Nutze dein Abo oder einen API-Schlüssel. Die Agenten laufen nur über den hier gewählten Zugang.",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/providers/en.json b/jarvis/ui/web/frontend/src/i18n/locales/providers/en.json
index 59053df64d..d674ab3010 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/providers/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/providers/en.json
@@ -96,6 +96,9 @@
"restart_title": "Restart to finish the update",
"restart_desc": "The new provider page needs the app's background service to restart once. It takes about ten seconds.",
"restart_action": "Restart now",
+ "agent_providers_desc": "Turn on every provider your agents may use. Open one to choose subscription or key and its models.",
+ "agent_providers_count": "{0} on",
+ "voice_save_hint": "Save to use these settings on your next call",
"tab_voice": "Live calls",
"tab_agents": "Agents",
"subscriptions_title": "Subscriptions",
@@ -116,7 +119,8 @@
"key_missing_short": "No key",
"key_desc_short": "One key for everything this provider does. Billed per use.",
"separate_title": "Separate keys",
- "accounts_title": "Several sign-ins per tool" ,
+ "accounts_title": "Several sign-ins per tool"
+,
"agent_providers_title": "Providers",
"access_title": "Access",
"access_desc": "Use your subscription or an API key. The agents run only on the one picked here.",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/providers/es.json b/jarvis/ui/web/frontend/src/i18n/locales/providers/es.json
index ad427dbb3a..bf8c967458 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/providers/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/providers/es.json
@@ -96,6 +96,9 @@
"restart_title": "Reinicia para terminar la actualización",
"restart_desc": "La nueva página de proveedores necesita reiniciar una vez el servicio de la app. Tarda unos diez segundos.",
"restart_action": "Reiniciar ahora",
+ "agent_providers_desc": "Activa cada proveedor que tus agentes pueden usar. Abre uno para elegir suscripción o clave y sus modelos.",
+ "agent_providers_count": "{0} activos",
+ "voice_save_hint": "Guarda para usar estos ajustes en tu próxima llamada",
"tab_voice": "Llamadas en directo",
"tab_agents": "Agentes",
"subscriptions_title": "Suscripciones",
@@ -116,7 +119,8 @@
"key_missing_short": "Sin clave",
"key_desc_short": "Una clave para todo lo que hace este proveedor. Se cobra por uso.",
"separate_title": "Claves propias",
- "accounts_title": "Varias sesiones por herramienta" ,
+ "accounts_title": "Varias sesiones por herramienta"
+,
"agent_providers_title": "Proveedores",
"access_title": "Acceso",
"access_desc": "Usa tu suscripción o una clave API. Los agentes solo funcionan con el acceso elegido aquí.",
diff --git a/jarvis/ui/web/frontend/src/views/ApiKeysView.providers.test.tsx b/jarvis/ui/web/frontend/src/views/ApiKeysView.providers.test.tsx
index c729ad07eb..ce0339d884 100644
--- a/jarvis/ui/web/frontend/src/views/ApiKeysView.providers.test.tsx
+++ b/jarvis/ui/web/frontend/src/views/ApiKeysView.providers.test.tsx
@@ -158,10 +158,10 @@ beforeEach(() => {
});
describe("ApiKeysView — Live calls", () => {
- it("opens on live calls with GPT-Live in the list and one OpenAI key row", async () => {
+ it("opens on live calls with GPT-Live and one OpenAI key row", async () => {
renderPage();
const voice = await screen.findByTestId("apikeys-voice");
- expect(within(voice).getByTestId("voice-provider-gpt-live").textContent).toContain("GPT-Live");
+ expect(within(voice).getByTestId("live-profile")).toBeTruthy();
expect(await within(voice).findByTestId("voice-key")).toBeTruthy();
});
@@ -270,6 +270,7 @@ describe("ApiKeysView — Agents", () => {
const detail = await screen.findByTestId("agent-provider-detail-claude-api");
await waitFor(() => expect(detail.textContent).toContain("[email protected]"));
expect(within(detail).getByTestId("subscription-disconnect")).toBeTruthy();
+ fireEvent.click(within(detail).getByRole("button", { name: "Runtime" }));
expect((within(detail).getByLabelText("Binary path") as HTMLInputElement).value).toBe("/usr/bin/claude");
});
});
diff --git a/jarvis/ui/web/frontend/src/views/ApiKeysView.tsx b/jarvis/ui/web/frontend/src/views/ApiKeysView.tsx
index 74614ca4f7..40e8f03e33 100644
--- a/jarvis/ui/web/frontend/src/views/ApiKeysView.tsx
+++ b/jarvis/ui/web/frontend/src/views/ApiKeysView.tsx
@@ -1,17 +1,14 @@
import { useEffect, useState } from "react";
-import { useQuery } from "@tanstack/react-query";
-import { Check, Loader2, RefreshCw } from "lucide-react";
+import { Loader2, RefreshCw } from "lucide-react";
import { PageHeader } from "@/components/layout/PageHeader";
-import { LiveProfile, liveProfileQuery, liveProfileReady } from "@/components/providers/LiveProfile";
-import { ProviderLogo } from "@/components/providers/ProviderLogo";
+import { LiveProfile } from "@/components/providers/LiveProfile";
import { Button } from "@/components/ui/button";
import { AgentsTab } from "@/views/apikeys/AgentsTab";
import { KeyField } from "@/views/apikeys/KeyField";
-import { DetailHeader, ListRow, MasterDetail } from "@/views/apikeys/settingsUi";
+import { UnderlineTabs } from "@/views/apikeys/ledger";
import { useProviders, useSectionHealth } from "@/hooks/useProviders";
import { useProviderFamilies } from "@/lib/providerFamilies";
import { useLocaleChunk, useT } from "@/i18n";
-import { cn } from "@/lib/utils";
import { useEventStore } from "@/store/events";
const TABS = ["voice", "agents"] as const;
@@ -29,14 +26,15 @@ function initialTab(): Tab {
}
/**
- * API Keys, in two parts behind one centred switch, both as a provider list
- * beside the selected provider's settings:
+ * API Keys, in two parts:
*
* - Live calls: the live voice runs on OpenAI GPT-Live — paid with the
- * ChatGPT subscription or one OpenAI key — with its voice and the thinking
- * model that answers with tools;
+ * ChatGPT subscription or one OpenAI key — with its few settings;
* - Agents: every company the assistant's agents can run on, any number of
* them on at once, each reached by its subscription or its API key.
+ *
+ * Both are set in type and hairlines on the page itself; nothing sits in a
+ * box inside a box.
*/
export function ApiKeysView() {
const t = useT();
@@ -86,14 +84,17 @@ export function ApiKeysView() {
</Button>
}
/>
- <div className="flex justify-center">
- <TabSwitch value={tab} onChange={choose} />
- </div>
+ <UnderlineTabs<Tab>
+ value={tab}
+ onChange={choose}
+ label={t("apikeys_view.title")}
+ options={TABS.map((value) => ({ value, label: t(`providers_page.tab_${value}`) }))}
+ />
</div>
<div
data-testid="api-keys-provider-scroll"
- className="min-h-0 flex-1 overflow-y-auto scrollbar-jarvis px-8 pb-10 pt-6"
+ className="min-h-0 flex-1 overflow-y-auto scrollbar-jarvis px-8 pb-12 pt-8"
>
<div key={tab} role="tabpanel" id="apikeys-panel" aria-labelledby={`apikeys-tab-${tab}`} className="profile-rise w-full">
{tab === "voice" && <VoiceTab data={families} onSaved={refetch} />}
@@ -109,93 +110,27 @@ export function ApiKeysView() {
);
}
-/** A segmented switch between the page's parts. */
-function TabSwitch({ value, onChange }: { value: Tab; onChange: (tab: Tab) => void }) {
- const t = useT();
- return (
- <div
- role="tablist"
- aria-label={t("apikeys_view.title")}
- data-testid="api-keys-category-tabs"
- className="inline-flex rounded-lg border border-border/60 bg-card/40 p-0.5"
- >
- {TABS.map((tab) => (
- <button
- key={tab}
- type="button"
- role="tab"
- id={`apikeys-tab-${tab}`}
- aria-selected={value === tab}
- aria-controls="apikeys-panel"
- onClick={() => onChange(tab)}
- className={cn(
- "h-7 rounded-md px-3 text-sm font-medium transition-colors",
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
- value === tab ? "bg-secondary text-foreground" : "text-muted-foreground hover:text-foreground",
- )}
- >
- {t(`providers_page.tab_${tab}`)}
- </button>
- ))}
- </div>
- );
-}
-
/**
- * Live calls run on OpenAI GPT-Live — the one live speech-to-speech model the
- * assistant runs — so the list holds that one provider, in the same list and
- * detail layout as the Agents tab: how it is paid for, its voice and the
- * thinking model that answers with tools.
+ * Live calls run on OpenAI GPT-Live, the one live speech-to-speech model the
+ * assistant runs: how it is paid for on the left, its few settings beside it.
*/
function VoiceTab({ data, onSaved }: { data: ReturnType<typeof useProviderFamilies>; onSaved: () => void }) {
- const t = useT();
const openai = data.families?.find((family) => family.id === "openai");
- const slot = openai?.key_slot ?? "openai_api_key";
- const live = useQuery(liveProfileQuery);
- const subscription = live.data?.profile.auth_mode === "chatgpt_subscription";
- const ready = liveProfileReady(live.data);
- const status = !live.data
- ? t("live.loading")
- : `${t(subscription ? "providers_page.access_subscription" : "providers_page.access_api_key")} · ${t(
- ready ? "providers_page.voice_ready" : "providers_page.voice_not_ready",
- )}`;
return (
<div data-testid="apikeys-voice">
- <MasterDetail
- testId="voice-provider-list"
- list={
- <ListRow
- testId="voice-provider-gpt-live"
- icon={<ProviderLogo providerId={openai?.logo_id ?? "openai"} label="OpenAI" size="sm" className="h-5 w-5" />}
- name="GPT-Live"
- status={status}
- selected
- dimmed={false}
- onSelect={() => undefined}
- trailing={ready ? <Check aria-label={t("providers_page.voice_ready")} className="h-4 w-4 text-accent" /> : null}
+ <LiveProfile
+ onSaved={onSaved}
+ keyField={
+ <KeyField
+ stacked
+ slot={openai?.key_slot ?? "openai_api_key"}
+ present={openai?.key_present ?? false}
+ providerLabel="OpenAI"
+ dashboardUrl={openai?.dashboard_url}
+ onChanged={() => void data.reload()}
+ testId="voice-key"
/>
}
- detail={
- <div className="space-y-2.5">
- <DetailHeader
- icon={<ProviderLogo providerId={openai?.logo_id ?? "openai"} label="OpenAI" size="sm" className="h-5 w-5" />}
- name="GPT-Live · OpenAI"
- />
- <LiveProfile
- onSaved={onSaved}
- keyField={
- <KeyField
- slot={slot}
- present={openai?.key_present ?? false}
- providerLabel="OpenAI"
- dashboardUrl={openai?.dashboard_url}
- onChanged={() => void data.reload()}
- testId="voice-key"
- />
- }
- />
- </div>
- }
/>
</div>
);
@@ -248,15 +183,10 @@ function RestartNeeded() {
}
return (
- <div
- role="status"
- data-testid="providers-restart-needed"
- className="flex items-center gap-4 rounded-xl border border-border/60 bg-card/40 px-4 py-3"
- >
- <RefreshCw aria-hidden="true" className="h-4 w-4 shrink-0 text-muted-foreground" />
+ <div role="status" data-testid="providers-restart-needed" className="flex items-center gap-6 border-y border-border/60 py-4">
<div className="min-w-0 flex-1">
<p className="text-sm font-medium text-foreground">{t("providers_page.restart_title")}</p>
- <p className="mt-0.5 text-xs text-muted-foreground">{t("providers_page.restart_desc")}</p>
+ <p className="mt-0.5 text-sm text-muted-foreground">{t("providers_page.restart_desc")}</p>
</div>
<Button size="sm" disabled={restarting} onClick={() => void restart()}>
{restarting && <Loader2 className="animate-spin" />}
diff --git a/jarvis/ui/web/frontend/src/views/apikeys/AgentsTab.tsx b/jarvis/ui/web/frontend/src/views/apikeys/AgentsTab.tsx
index 43ca5dd408..43c7bedaa7 100644
--- a/jarvis/ui/web/frontend/src/views/apikeys/AgentsTab.tsx
+++ b/jarvis/ui/web/frontend/src/views/apikeys/AgentsTab.tsx
@@ -1,6 +1,6 @@
-import { useEffect, useMemo, useState, type ReactNode } from "react";
+import { useEffect, useMemo, useState } from "react";
import { useQuery, useQueryClient } from "@tanstack/react-query";
-import { Check, FlaskConical, Loader2, LogIn, LogOut } from "lucide-react";
+import { ChevronRight, FlaskConical, Loader2, LogIn, LogOut } from "lucide-react";
import { AgentAccountsPanel } from "@/components/AgentAccountsPanel";
import { PromptWriterCard } from "@/components/PromptWriterCard";
import { ProviderLogo } from "@/components/providers/ProviderLogo";
@@ -48,17 +48,8 @@ import { cn } from "@/lib/utils";
import { useEventStore } from "@/store/events";
import { KeyField } from "./KeyField";
import { accessPatch, familyAccess, nextDefault, onPatch, withPatch, type Access, type FamilyAccess } from "./agentAccess";
+import { Choice, Disclosure, Row, Rows, Section, StatusLine, ToggleChip } from "./ledger";
import { familyState, type FamilyState } from "./providers/familyState";
-import {
- DetailHeader,
- ListRow,
- MasterDetail,
- ModelList,
- ModelListRow,
- Segmented,
- SettingsRow,
- SettingsSection,
-} from "./settingsUi";
type FamiliesData = ReturnType<typeof useProviderFamilies>;
@@ -81,6 +72,7 @@ export function shortVersion(raw: string | null | undefined): string | null {
}
const SOCIETY_CATALOG_KEY = ["agent-chat", "catalog", "society"] as const;
+const TEST_TIER_ORDER: ProviderDescriptor["tier"][] = ["brain", "realtime", "tts", "stt", "dictation"];
/**
* The agents' provider choices and the one action that changes them: save a
@@ -147,11 +139,10 @@ function useAgentProviders(entriesFor: (prefs: AgentProviderPrefs) => FamilyAcce
type AgentProviders = ReturnType<typeof useAgentProviders>;
/**
- * The Agents tab: every company the assistant's agents can run on, as one
- * list beside the selected company's settings. Any number of companies are
- * on at once — each one connected is one more seat an agent can sit on.
- * Inside a company the person picks how it is reached (subscription or API
- * key) and which of its models the agents are offered.
+ * The Agents tab: every company the assistant's agents can run on, one line
+ * each. Any number are on at once; a line opens in place to set the company
+ * up — how it is reached, whether it takes the tasks nobody assigned, and
+ * which of its models the agents are offered.
*/
export function AgentsTab({
data,
@@ -186,120 +177,129 @@ export function AgentsTab({
const entriesFor = (prefs: AgentProviderPrefs) => listed.map((f) => familyAccess(f, mapping, prefs, states[f.id]));
const control = useAgentProviders(entriesFor, agents?.brain_primary ?? "", refresh);
const entries = entriesFor(control.prefs);
-
- const [selectedId, setSelectedId] = useState<string | null>(null);
- useEffect(() => {
- if (selectedId || !entries.length) return;
- const primary = entries.find((fa) => fa.rows.some((row) => row.is_active_brain));
- setSelectedId((primary ?? entries.find((fa) => fa.on) ?? entries[0]).family.id);
- }, [entries, selectedId]);
- const selected = entries.find((fa) => fa.family.id === selectedId) ?? null;
+ const [openId, setOpenId] = useState<string | null>(null);
+ const onCount = entries.filter((entry) => entry.on).length;
return (
- <div className="flex flex-col gap-10" data-testid="apikeys-agents">
- <SettingsSection title={t("providers_page.agent_providers_title")} plain data-testid="agents-providers">
- <MasterDetail
- testId="agent-provider-list"
- list={entries.map((fa) => (
- <ProviderListRow
- key={fa.family.id}
- entry={fa}
- state={states[fa.family.id]}
- selected={fa.family.id === selectedId}
- onSelect={() => setSelectedId(fa.family.id)}
+ <div className="flex flex-col gap-14" data-testid="apikeys-agents">
+ <Section
+ title={t("providers_page.agent_providers_title")}
+ description={t("providers_page.agent_providers_desc")}
+ action={<span className="text-sm text-muted-foreground">{t("providers_page.agent_providers_count").replace("{0}", String(onCount))}</span>}
+ data-testid="agents-providers"
+ >
+ <Rows>
+ {entries.map((entry) => (
+ <ProviderLine
+ key={entry.family.id}
+ entry={entry}
+ state={states[entry.family.id]}
+ open={openId === entry.family.id}
+ onToggle={() => setOpenId((id) => (id === entry.family.id ? null : entry.family.id))}
control={control}
+ onChanged={refresh}
/>
))}
- detail={
- selected && states[selected.family.id] ? (
- <ProviderDetail
- key={selected.family.id}
- entry={selected}
- state={states[selected.family.id]}
- control={control}
- onChanged={refresh}
- />
- ) : null
- }
- />
- </SettingsSection>
+ </Rows>
+ </Section>
+
<AgentSettings />
- <SettingsSection title={t("providers_page.accounts_title")} plain>
- <AgentAccountsPanel />
- </SettingsSection>
+
+ <div className="border-t border-border/60 pt-2">
+ <Disclosure label={t("providers_page.accounts_title")} testId="agent-accounts">
+ <AgentAccountsPanel />
+ </Disclosure>
+ </div>
</div>
);
}
-/** One entry per company, named and marked as the company, whichever access it uses. */
-function displayName(family: ProviderFamily): string {
- return family.label;
-}
-
-function logoOf(family: ProviderFamily): string {
- return family.logo_id;
-}
-
/** The line under a company's name: how it is reached, or what it still needs. */
-function entryStatus(entry: FamilyAccess, state: FamilyState | undefined, t: (key: string) => string): string {
- if (entry.access === "local") return t("providers_page.status_local");
+function entryStatus(entry: FamilyAccess, state: FamilyState | undefined, t: (key: string) => string): { tone: "ok" | "off" | "warn" | "error"; text: string } {
+ if (state?.failing) return { tone: "error", text: state.failing };
+ if (entry.access === "local") return { tone: "ok", text: t("providers_page.status_local") };
if (entry.access === "subscription") {
- if (!state?.subscription) return t("providers_page.subscription_unknown");
+ if (!state?.subscription) return { tone: "off", text: t("providers_page.subscription_unknown") };
if (state.subscriptionOn) {
- return state.account
- ? t("providers_page.status_subscription_as").replace("{0}", state.account)
- : t("providers_page.status_subscription");
+ return {
+ tone: "ok",
+ text: state.account ? t("providers_page.status_subscription_as").replace("{0}", state.account) : t("providers_page.status_subscription"),
+ };
}
- if (!state.subscription.installed) return t("providers_page.not_installed");
- return t("providers_page.not_signed_in");
+ return { tone: "off", text: t(state.subscription.installed ? "providers_page.not_signed_in" : "providers_page.not_installed") };
}
- if (entry.family.key_present) return t("providers_page.status_key");
- if (state?.viaProject) return t("providers_page.status_project");
- return t("providers_page.key_missing_short");
+ if (entry.family.key_present) return { tone: "ok", text: t("providers_page.status_key") };
+ if (state?.viaProject) return { tone: "ok", text: t("providers_page.status_project") };
+ return { tone: "off", text: t("providers_page.key_missing_short") };
}
-function ProviderListRow({
+function ProviderLine({
entry,
state,
- selected,
- onSelect,
+ open,
+ onToggle,
control,
+ onChanged,
}: {
entry: FamilyAccess;
state: FamilyState | undefined;
- selected: boolean;
- onSelect: () => void;
+ open: boolean;
+ onToggle: () => void;
control: AgentProviders;
+ onChanged: () => Promise<void>;
}) {
const t = useT();
const family = entry.family;
- const name = displayName(family);
- const label = t("providers_page.agents_use_for").replace("{0}", name);
+ const status = entryStatus(entry, state, t);
+ const version = entry.access === "subscription" ? shortVersion(state?.subscription?.version) : null;
+ const isDefault = entry.on && entry.rows.some((row) => row.is_active_brain);
+ const switchLabel = t("providers_page.agents_use_for").replace("{0}", family.label);
+
return (
- <ListRow
- testId={`agent-provider-${family.id}`}
- icon={<ProviderLogo providerId={logoOf(family)} label={name} size="sm" className="h-5 w-5" />}
- name={name}
- version={entry.access === "subscription" ? shortVersion(state?.subscription?.version) : null}
- status={entryStatus(entry, state, t)}
- dot={state?.failing ? "error" : null}
- selected={selected}
- dimmed={!entry.on}
- onSelect={onSelect}
- trailing={
+ <div data-testid={`agent-provider-${family.id}`}>
+ <div className="flex items-center gap-4 py-3.5">
+ <button
+ type="button"
+ aria-expanded={open}
+ aria-label={family.label}
+ onClick={onToggle}
+ className="group flex min-w-0 flex-1 items-center gap-4 rounded-md text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
+ >
+ <ProviderLogo providerId={family.logo_id} label={family.label} className={cn(!entry.on && "opacity-60")} />
+ <span className="min-w-0 flex-1">
+ <span className="flex min-w-0 items-baseline gap-2">
+ <span className={cn("truncate text-sm font-medium", entry.on ? "text-foreground" : "text-muted-foreground")}>{family.label}</span>
+ {version ? <code className="shrink-0 text-xs text-muted-foreground">{version}</code> : null}
+ {isDefault ? (
+ <span className="shrink-0 rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-foreground">
+ {t("providers_page.default_on")}
+ </span>
+ ) : null}
+ </span>
+ <span className="mt-0.5 flex min-w-0">
+ <StatusLine tone={status.tone}>{status.text}</StatusLine>
+ </span>
+ </span>
+ <ChevronRight
+ aria-hidden="true"
+ className={cn("h-4 w-4 shrink-0 text-muted-foreground transition-transform motion-reduce:transition-none", open && "rotate-90")}
+ />
+ </button>
<Switch
checked={entry.on}
disabled={!entry.ready || !control.ready || control.busy !== null}
onCheckedChange={(on) => void control.save(family.id, onPatch(entry, on, control.prefs))}
- aria-label={label}
- title={entry.ready ? label : t("providers_page.agents_needs_access")}
+ aria-label={switchLabel}
+ title={entry.ready ? switchLabel : t("providers_page.agents_needs_access")}
/>
- }
- />
+ </div>
+ {open && state ? <ProviderSetup entry={entry} state={state} control={control} onChanged={onChanged} /> : null}
+ </div>
);
}
-function ProviderDetail({
+/** A company's setup, opened in place under its line. */
+function ProviderSetup({
entry,
state,
control,
@@ -312,7 +312,6 @@ function ProviderDetail({
}) {
const t = useT();
const family = entry.family;
- const name = displayName(family);
const subscription = entry.access === "subscription";
const keyed = entry.access === "api_key";
const testCard = keyed
@@ -320,94 +319,81 @@ function ProviderDetail({
: undefined;
return (
- <div data-testid={`agent-provider-detail-${family.id}`} className="space-y-6">
- <div className="space-y-2.5">
- <DetailHeader
- icon={<ProviderLogo providerId={logoOf(family)} label={name} size="sm" className="h-5 w-5" />}
- name={name}
- version={subscription ? shortVersion(state.subscription?.version) : null}
- />
- <SettingsSectionCard>
- {entry.choices.length > 1 && (
- <SettingsRow
- title={t("providers_page.access_title")}
- description={t("providers_page.access_desc")}
- control={
- <Segmented<Access>
- testId="agent-provider-access"
- label={t("providers_page.access_title")}
- value={entry.access}
- disabled={!control.ready || control.busy !== null}
- onChange={(access) => void control.save(family.id, accessPatch(entry, access, control.prefs))}
- options={entry.choices.map((choice) => ({ value: choice, label: t(`providers_page.access_${choice}`) }))}
- />
- }
- />
- )}
- {subscription && family.subscription && <SubscriptionAccountRow family={family} state={state} onChanged={onChanged} />}
- {keyed && family.key_slot && (
- <KeyField
- slot={family.key_slot}
- present={family.key_present}
- providerLabel={family.label}
- dashboardUrl={family.dashboard_url}
- description={state.viaProject && !family.key_present ? t("providers_page.key_project_hint") : t("providers_page.key_desc_short")}
- onChanged={onChanged}
- />
- )}
- {entry.access === "local" && (
- <SettingsRow title={t("providers_page.local_title")} description={t("providers_page.local_desc")} />
- )}
- {entry.rows.map((row) => (
- <DefaultRow
- key={row.jarvis}
- row={row}
- label={family.local ? row.label ?? family.label : name}
- entry={entry}
- control={control}
- />
- ))}
- {keyed && family.key_present && testCard && (
- <SettingsRow
- title={t("providers_page.key_test_label")}
- description={t("providers_page.key_test_hint")}
- control={<ProviderTestControl providerId={testCard.id} providerLabel={testCard.label} section={testCard.tier} active={testCard.active} />}
- />
- )}
- </SettingsSectionCard>
- </div>
-
- {entry.rows.map((row) => (
- <AgentModels
- key={row.jarvis}
- providerId={row.jarvis}
- title={entry.rows.length > 1 ? `${t("providers_page.models_title")} · ${row.label ?? row.jarvis}` : t("providers_page.models_title")}
- control={control}
- familyId={family.id}
- />
- ))}
-
- {subscription && family.subscription && state.subscription?.installed && (
- <SettingsSection title={t("providers_page.runtime")}>
- <BinaryPathRow
- kind={family.subscription.kind}
- path={"binary_path" in state.subscription ? state.subscription.binary_path ?? "" : ""}
+ <div data-testid={`agent-provider-detail-${family.id}`} className="pb-5 pl-[3.25rem]">
+ <Rows>
+ {entry.choices.length > 1 && (
+ <Row
+ title={t("providers_page.access_title")}
+ description={t("providers_page.access_desc")}
+ control={
+ <Choice<Access>
+ testId="agent-provider-access"
+ label={t("providers_page.access_title")}
+ value={entry.access}
+ disabled={!control.ready || control.busy !== null}
+ onChange={(access) => void control.save(family.id, accessPatch(entry, access, control.prefs))}
+ options={entry.choices.map((choice) => ({ value: choice, label: t(`providers_page.access_${choice}`) }))}
+ />
+ }
+ />
+ )}
+ {subscription && family.subscription && <AccountRow family={family} state={state} onChanged={onChanged} />}
+ {keyed && family.key_slot && (
+ <KeyField
+ slot={family.key_slot}
+ present={family.key_present}
+ providerLabel={family.label}
+ dashboardUrl={family.dashboard_url}
+ description={state.viaProject && !family.key_present ? t("providers_page.key_project_hint") : t("providers_page.key_desc_short")}
onChanged={onChanged}
/>
- <SettingsRow
- title={t("providers_page.cli_check")}
- description={t("providers_page.cli_check_hint")}
- control={<CliTest endpoint={CLI[family.subscription.kind].test} onChanged={onChanged} />}
+ )}
+ {entry.access === "local" && <Row title={t("providers_page.local_title")} description={t("providers_page.local_desc")} />}
+ {entry.rows.map((row) => (
+ <DefaultRow key={row.jarvis} row={row} label={family.local ? row.label ?? family.label : family.label} entry={entry} control={control} />
+ ))}
+ {entry.rows.map((row) => (
+ <AgentModels
+ key={`models-${row.jarvis}`}
+ providerId={row.jarvis}
+ title={entry.rows.length > 1 ? `${t("providers_page.models_title")} · ${row.label ?? row.jarvis}` : t("providers_page.models_title")}
+ control={control}
+ familyId={family.id}
/>
- </SettingsSection>
- )}
+ ))}
+ {keyed && family.key_present && testCard && (
+ <Row
+ title={t("providers_page.key_test_label")}
+ description={t("providers_page.key_test_hint")}
+ control={<ProviderTestControl providerId={testCard.id} providerLabel={testCard.label} section={testCard.tier} active={testCard.active} />}
+ />
+ )}
+ {keyed && <SeparateKeys family={family} onChanged={onChanged} />}
+ </Rows>
- {keyed && <SeparateKeys family={family} onChanged={onChanged} />}
+ {subscription && family.subscription && state.subscription?.installed && (
+ <div className="border-t border-border/60 pt-1">
+ <Disclosure label={t("providers_page.runtime")} testId={`agent-runtime-${family.id}`}>
+ <Rows className="border-t-0">
+ <BinaryPathRow
+ kind={family.subscription.kind}
+ path={"binary_path" in state.subscription ? state.subscription.binary_path ?? "" : ""}
+ onChanged={onChanged}
+ />
+ <Row
+ title={t("providers_page.cli_check")}
+ description={t("providers_page.cli_check_hint")}
+ control={<CliTest endpoint={CLI[family.subscription.kind].test} onChanged={onChanged} />}
+ />
+ </Rows>
+ </Disclosure>
+ </div>
+ )}
</div>
);
}
-function SubscriptionAccountRow({ family, state, onChanged }: { family: ProviderFamily; state: FamilyState; onChanged: () => Promise<void> }) {
+function AccountRow({ family, state, onChanged }: { family: ProviderFamily; state: FamilyState; onChanged: () => Promise<void> }) {
const t = useT();
const pushToast = useEventStore((s) => s.pushToast);
const kind = family.subscription!.kind;
@@ -447,28 +433,26 @@ function SubscriptionAccountRow({ family, state, onChanged }: { family: Provider
}
}
- const line = !state.subscription
- ? t("providers_page.subscription_unknown")
- : state.subscriptionOn
- ? state.account
- ? t("providers_page.authenticated_as").replace("{0}", state.account)
- : t("providers_page.authenticated")
- : !installed
- ? card?.install_hint || t("providers_page.subscription_install")
- : t("providers_page.not_signed_in");
+ const line = pending === "waiting"
+ ? t(cli.where === "browser" ? "providers_page.login_waiting_browser" : "providers_page.login_waiting_terminal")
+ : !status
+ ? t("providers_page.subscription_unknown")
+ : state.subscriptionOn
+ ? state.account
+ ? t("providers_page.authenticated_as").replace("{0}", state.account)
+ : t("providers_page.authenticated")
+ : !installed
+ ? card?.install_hint || t("providers_page.subscription_install")
+ : t("providers_page.not_signed_in");
return (
- <SettingsRow
+ <Row
data-testid={`subscription-account-${kind}`}
title={t("providers_page.account")}
- status={
- pending === "waiting"
- ? t(cli.where === "browser" ? "providers_page.login_waiting_browser" : "providers_page.login_waiting_terminal")
- : line
- }
+ description={line}
control={
state.subscriptionOn ? (
- <Button size="sm" variant="outline" data-testid="subscription-disconnect" disabled={pending !== null} onClick={() => void disconnect()}>
+ <Button size="sm" variant="ghost" className="text-muted-foreground" data-testid="subscription-disconnect" disabled={pending !== null} onClick={() => void disconnect()}>
{pending === "logout" ? <Loader2 className="animate-spin" /> : <LogOut />}
{t("providers_page.disconnect")}
</Button>
@@ -491,21 +475,17 @@ function DefaultRow({ row, label, entry, control }: { row: AgentRowStatus; label
const t = useT();
const isDefault = row.is_active_brain && entry.on;
return (
- <SettingsRow
+ <Row
data-testid={`agent-default-row-${row.jarvis}`}
title={t("providers_page.default_title")}
- description={t("providers_page.default_desc")}
- status={!entry.ready ? t("providers_page.agents_needs_access") : undefined}
+ description={!entry.ready ? t("providers_page.agents_needs_access") : t("providers_page.default_desc")}
control={
isDefault ? (
- <span className="inline-flex items-center gap-1.5 text-sm font-medium text-foreground">
- <Check aria-hidden="true" className="h-4 w-4 text-accent" />
- {t("providers_page.default_on")}
- </span>
+ <span className="text-sm font-medium text-foreground">{t("providers_page.default_on")}</span>
) : (
<Button
size="sm"
- variant="outline"
+ variant="ghost"
data-testid={`agent-make-default-${row.jarvis}`}
disabled={!entry.on || control.busy !== null}
onClick={() => void control.chooseDefault(row, label)}
@@ -520,8 +500,8 @@ function DefaultRow({ row, label, entry, control }: { row: AgentRowStatus; label
}
/**
- * The models a provider offers the agents, each with a switch: a model
- * switched off is left out of every agent's model picker.
+ * The models a provider offers the agents, as chips: a chip switched off is
+ * left out of every agent's model picker.
*/
function AgentModels({ providerId, title, control, familyId }: { providerId: string; title: string; control: AgentProviders; familyId: string }) {
const t = useT();
@@ -547,55 +527,43 @@ function AgentModels({ providerId, title, control, familyId }: { providerId: str
const busy = !control.ready || control.busy !== null;
return (
- <SettingsSection title={title} plain data-testid={`agent-models-${providerId}`}>
- {models.length === 0 ? (
- <div className="rounded-xl border border-border/60 bg-card/40 px-4 py-3 text-xs text-muted-foreground">
- {loading ? t("providers_page.models_loading") : t("providers_page.models_none")}
- </div>
- ) : (
- <ModelList
- header={t("providers_page.models_count").replace("{0}", String(shown)).replace("{1}", String(models.length))}
- action={
- <Button
- size="sm"
- variant="ghost"
- className="h-7 text-xs"
- disabled={busy}
- onClick={() => setHidden(shown === 0 ? [] : models.map((model) => model.id))}
- >
- {shown === 0 ? t("providers_page.models_show_all") : t("providers_page.models_hide_all")}
- </Button>
- }
- >
+ <Row
+ data-testid={`agent-models-${providerId}`}
+ title={title}
+ description={
+ models.length === 0
+ ? loading ? t("providers_page.models_loading") : t("providers_page.models_none")
+ : t("providers_page.models_count").replace("{0}", String(shown)).replace("{1}", String(models.length))
+ }
+ control={
+ models.length > 0 ? (
+ <Button
+ size="sm"
+ variant="ghost"
+ className="text-muted-foreground"
+ disabled={busy}
+ onClick={() => setHidden(shown === 0 ? [] : models.map((model) => model.id))}
+ >
+ {shown === 0 ? t("providers_page.models_show_all") : t("providers_page.models_hide_all")}
+ </Button>
+ ) : undefined
+ }
+ >
+ {models.length > 0 ? (
+ <div className="flex flex-wrap gap-1.5">
{models.map((model) => (
- <ModelListRow
+ <ToggleChip
key={model.id}
- name={model.label || model.id}
- id={model.id}
- note={model.note ?? (model.efforts?.length ? t("providers_page.models_reasoning") : null)}
- muted={hidden.has(model.id)}
- control={
- <Switch
- checked={!hidden.has(model.id)}
- disabled={busy}
- onCheckedChange={(on) => setHidden(toggled([...hidden], [model.id], on))}
- aria-label={model.label || model.id}
- />
- }
+ on={!hidden.has(model.id)}
+ label={model.label || model.id}
+ hint={model.id}
+ disabled={busy}
+ onToggle={() => setHidden(toggled([...hidden], [model.id], hidden.has(model.id)))}
/>
))}
- </ModelList>
- )}
- </SettingsSection>
- );
-}
-
-/** A plain card (no section title) for the rows under a detail header. */
-function SettingsSectionCard({ children }: { children: ReactNode }) {
- return (
- <div className="overflow-hidden rounded-xl border border-border/60 bg-card/40 [&>*+*]:border-t [&>*+*]:border-border/50">
- {children}
- </div>
+ </div>
+ ) : null}
+ </Row>
);
}
@@ -620,7 +588,7 @@ function BinaryPathRow({ kind, path, onChanged }: { kind: SubscriptionKind; path
}
return (
- <SettingsRow
+ <Row
title={t("providers_page.binary_path")}
description={t("providers_page.binary_path_hint")}
control={
@@ -634,7 +602,7 @@ function BinaryPathRow({ kind, path, onChanged }: { kind: SubscriptionKind; path
onKeyDown={(event) => {
if (event.key === "Enter") void commit();
}}
- className={cn("h-8 font-mono text-sm sm:w-72", !editable && "text-muted-foreground")}
+ className={cn("h-8 font-mono text-sm sm:w-80", !editable && "text-muted-foreground")}
/>
}
/>
@@ -668,12 +636,12 @@ function CliTest({ endpoint, onChanged }: { endpoint: string; onChanged: () => P
<span
role="status"
title={error ?? result?.message}
- className={cn("max-w-[16rem] truncate text-xs", error || (result && !result.ok) ? "text-destructive" : "text-muted-foreground")}
+ className={cn("max-w-[16rem] truncate text-sm", error || (result && !result.ok) ? "text-destructive" : "text-muted-foreground")}
>
{error ?? result?.message}
</span>
)}
- <Button size="sm" variant="outline" disabled={running} onClick={() => void run()}>
+ <Button size="sm" variant="ghost" disabled={running} onClick={() => void run()}>
{running ? <Loader2 className="animate-spin" /> : <FlaskConical />}
{t("providers_page.test")}
</Button>
@@ -681,8 +649,6 @@ function CliTest({ endpoint, onChanged }: { endpoint: string; onChanged: () => P
);
}
-const TEST_TIER_ORDER: ProviderDescriptor["tier"][] = ["brain", "realtime", "tts", "stt", "dictation"];
-
/** Features that still hold a key of their own, each with a way back onto the main key. */
function SeparateKeys({ family, onChanged }: { family: ProviderFamily; onChanged: () => Promise<void> }) {
const t = useT();
@@ -705,9 +671,9 @@ function SeparateKeys({ family, onChanged }: { family: ProviderFamily; onChanged
}
return (
- <SettingsSection title={t("providers_page.separate_title")}>
+ <>
{family.separate_keys.map((entry) => (
- <SettingsRow
+ <Row
key={entry.slot}
data-testid={`provider-separate-key-${entry.slot}`}
title={t(`providers_page.separate_${entry.surface}`)}
@@ -715,7 +681,7 @@ function SeparateKeys({ family, onChanged }: { family: ProviderFamily; onChanged
control={
<Button
size="sm"
- variant="outline"
+ variant="ghost"
disabled={merging !== null || !family.key_present}
title={family.key_present ? undefined : t("providers_page.separate_needs_main")}
onClick={() => void merge(entry.slot)}
@@ -726,7 +692,7 @@ function SeparateKeys({ family, onChanged }: { family: ProviderFamily; onChanged
}
/>
))}
- </SettingsSection>
+ </>
);
}
@@ -742,7 +708,7 @@ function AgentSettings() {
const res = await fetch("/api/jarvis-agent/status", { cache: "no-store" });
if (res.ok) setStatus((await res.json()) as SubagentStatus);
} catch (cause) {
- // The model card stays hidden; the list above reports the same
+ // The model picker stays hidden; the list above reports the same
// endpoint's failure.
console.debug("agent status unavailable", cause);
}
@@ -755,11 +721,11 @@ function AgentSettings() {
}, []);
return (
- <SettingsSection title={t("providers_page.agent_settings_title")} plain data-testid="provider-agent-settings">
- <div className="grid gap-4 xl:grid-cols-2">
+ <Section title={t("providers_page.agent_settings_title")} description={t("providers_page.agent_settings_desc")} data-testid="provider-agent-settings">
+ <div className="grid gap-x-12 gap-y-6 border-t border-border/60 pt-5 xl:grid-cols-2">
{status && <SubagentModelCard status={status} onSaved={() => void reload()} />}
<PromptWriterCard />
</div>
- </SettingsSection>
+ </Section>
);
}
diff --git a/jarvis/ui/web/frontend/src/views/apikeys/KeyField.tsx b/jarvis/ui/web/frontend/src/views/apikeys/KeyField.tsx
index 05e33e5df4..c33fe89cf0 100644
--- a/jarvis/ui/web/frontend/src/views/apikeys/KeyField.tsx
+++ b/jarvis/ui/web/frontend/src/views/apikeys/KeyField.tsx
@@ -7,7 +7,7 @@ import { useT } from "@/i18n";
import { keyMatchesSecret } from "@/lib/keyFormat";
import { openExternalUrl } from "@/lib/openExternal";
import { useEventStore } from "@/store/events";
-import { SettingsRow } from "./settingsUi";
+import { Row } from "./ledger";
function announce(slot: string, action: "set" | "delete") {
// Every mounted list and the health dots re-read. Only the slot NAME
@@ -30,6 +30,7 @@ export function KeyField({
description,
onChanged,
testId = "provider-key",
+ stacked = false,
}: {
slot: string;
present: boolean;
@@ -39,6 +40,8 @@ export function KeyField({
description?: string;
onChanged?: () => void | Promise<void>;
testId?: string;
+ /** Field under the text, full width — for a narrow column. */
+ stacked?: boolean;
}) {
const t = useT();
const pushToast = useEventStore((s) => s.pushToast);
@@ -96,8 +99,8 @@ export function KeyField({
) : null;
const control = showInput ? (
- <div className="flex w-full items-center gap-2 sm:w-auto">
- <div className="relative min-w-0 flex-1 sm:w-72 sm:flex-none">
+ <div className={stacked ? "flex w-full items-center gap-2" : "flex w-full items-center gap-2 sm:w-auto"}>
+ <div className={stacked ? "relative min-w-0 flex-1" : "relative min-w-0 flex-1 sm:w-72 sm:flex-none"}>
<Input
type={reveal ? "text" : "password"}
autoComplete="off"
@@ -164,31 +167,38 @@ export function KeyField({
</>
);
+ const statusNode = (
+ <span className="flex flex-wrap items-center gap-x-3 gap-y-1">
+ <span className="inline-flex items-center gap-1.5">
+ <span aria-hidden="true" className={present ? "h-1.5 w-1.5 rounded-full bg-success" : "h-1.5 w-1.5 rounded-full bg-border-strong"} />
+ {confirmDelete
+ ? t("providers_page.key_remove_confirm")
+ : present
+ ? t("providers_page.key_saved_hint")
+ : t("providers_page.key_missing_hint")}
+ </span>
+ {getKey}
+ {format && !format.match && format.detected && (
+ <span role="status" className="inline-flex items-center gap-1 text-warning">
+ <AlertTriangle aria-hidden="true" className="h-3.5 w-3.5" />
+ {t("providers_page.key_format_warning")
+ .replace("{0}", format.detected.label)
+ .replace("{1}", providerLabel)}
+ </span>
+ )}
+ </span>
+ );
+
return (
- <SettingsRow
+ <Row
data-testid={testId}
+ stacked={stacked}
title={title ?? t("providers_page.key_label")}
- description={description}
- status={
- <span className="flex flex-wrap items-center gap-x-2 gap-y-1">
- <span className="inline-flex items-center gap-1.5">
- <span aria-hidden="true" className={present ? "h-1.5 w-1.5 rounded-full bg-success" : "h-1.5 w-1.5 rounded-full bg-border-strong"} />
- {confirmDelete
- ? t("providers_page.key_remove_confirm")
- : present
- ? t("providers_page.key_saved_hint")
- : t("providers_page.key_missing_hint")}
- </span>
- {getKey}
- {format && !format.match && format.detected && (
- <span role="status" className="inline-flex items-center gap-1 text-warning">
- <AlertTriangle aria-hidden="true" className="h-3.5 w-3.5" />
- {t("providers_page.key_format_warning")
- .replace("{0}", format.detected.label)
- .replace("{1}", providerLabel)}
- </span>
- )}
- </span>
+ description={
+ <>
+ {description ? <span className="block">{description}</span> : null}
+ <span className={description ? "mt-1.5 block" : "block"}>{statusNode}</span>
+ </>
}
control={control}
/>
diff --git a/jarvis/ui/web/frontend/src/views/apikeys/ledger.tsx b/jarvis/ui/web/frontend/src/views/apikeys/ledger.tsx
new file mode 100644
index 0000000000..9f1301e7d7
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/views/apikeys/ledger.tsx
@@ -0,0 +1,250 @@
+import { useState, type ComponentPropsWithoutRef, type ReactNode } from "react";
+import { ChevronRight } from "lucide-react";
+import { cn } from "@/lib/utils";
+
+/**
+ * The provider page's visual grammar: type and hairlines, no boxes.
+ *
+ * A section is a heading with one quiet sentence. Its rows sit on the page
+ * itself, separated by hairlines that run the width of the column — the
+ * structure comes from alignment and rhythm, never from a card around a card.
+ * Controls are small and sit on the right edge of their row.
+ */
+export function Section({
+ title,
+ description,
+ action,
+ children,
+ className,
+ ...props
+}: Omit<ComponentPropsWithoutRef<"section">, "title"> & {
+ title: ReactNode;
+ description?: ReactNode;
+ action?: ReactNode;
+ children: ReactNode;
+}) {
+ return (
+ <section {...props} className={cn("min-w-0", className)}>
+ <header className="flex items-end justify-between gap-6 pb-3">
+ <div className="min-w-0">
+ <h2 className="text-base font-semibold text-foreground-strong">{title}</h2>
+ {description ? <p className="mt-1 max-w-2xl text-sm text-muted-foreground">{description}</p> : null}
+ </div>
+ {action ? <div className="flex shrink-0 items-center gap-2">{action}</div> : null}
+ </header>
+ {children}
+ </section>
+ );
+}
+
+/** Rows divided by hairlines, with a hairline above the first. */
+export function Rows({ className, ...props }: ComponentPropsWithoutRef<"div">) {
+ return <div {...props} className={cn("divide-y divide-border/60 border-t border-border/60", className)} />;
+}
+
+/** One setting: what it is on the left, its control on the right. */
+export function Row({
+ title,
+ description,
+ control,
+ children,
+ stacked = false,
+ className,
+ ...props
+}: Omit<ComponentPropsWithoutRef<"div">, "title"> & {
+ title: ReactNode;
+ description?: ReactNode;
+ control?: ReactNode;
+ /** Content under the row, full width (an account picker, a list of chips). */
+ children?: ReactNode;
+ /** Control under the text instead of beside it (narrow columns). */
+ stacked?: boolean;
+}) {
+ return (
+ <div {...props} className={cn("py-4", className)}>
+ <div
+ className={cn(
+ "flex flex-col gap-3",
+ !stacked && "sm:flex-row sm:items-center sm:justify-between sm:gap-8",
+ )}
+ >
+ <div className="min-w-0">
+ <div className="text-sm font-medium text-foreground">{title}</div>
+ {description ? <div className="mt-0.5 max-w-xl text-sm text-muted-foreground">{description}</div> : null}
+ </div>
+ {control ? <div className="flex min-w-0 shrink-0 flex-wrap items-center gap-2">{control}</div> : null}
+ </div>
+ {children ? <div className="pt-3">{children}</div> : null}
+ </div>
+ );
+}
+
+/** Text tabs on a hairline, the selected one underlined. */
+export function UnderlineTabs<T extends string>({
+ value,
+ options,
+ onChange,
+ label,
+}: {
+ value: T;
+ options: { value: T; label: string }[];
+ onChange: (value: T) => void;
+ label: string;
+}) {
+ return (
+ <div role="tablist" aria-label={label} data-testid="api-keys-category-tabs" className="flex gap-7 border-b border-border/60">
+ {options.map((option) => {
+ const selected = option.value === value;
+ return (
+ <button
+ key={option.value}
+ type="button"
+ role="tab"
+ id={`apikeys-tab-${option.value}`}
+ aria-selected={selected}
+ aria-controls="apikeys-panel"
+ onClick={() => onChange(option.value)}
+ className={cn(
+ "-mb-px h-10 border-b-2 text-sm font-medium transition-colors",
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
+ selected
+ ? "border-foreground text-foreground-strong"
+ : "border-transparent text-muted-foreground hover:text-foreground",
+ )}
+ >
+ {option.label}
+ </button>
+ );
+ })}
+ </div>
+ );
+}
+
+/** A small two- or three-way choice, as a pill track. */
+export function Choice<T extends string>({
+ value,
+ options,
+ onChange,
+ label,
+ disabled,
+ testId,
+}: {
+ value: T;
+ options: { value: T; label: string }[];
+ onChange: (value: T) => void;
+ label: string;
+ disabled?: boolean;
+ testId?: string;
+}) {
+ return (
+ <div role="radiogroup" aria-label={label} data-testid={testId} className="inline-flex rounded-full bg-secondary/70 p-0.5">
+ {options.map((option) => {
+ const selected = option.value === value;
+ return (
+ <button
+ key={option.value}
+ type="button"
+ role="radio"
+ aria-checked={selected}
+ disabled={disabled}
+ onClick={() => !selected && onChange(option.value)}
+ className={cn(
+ "h-7 rounded-full px-3 text-xs font-medium transition-colors disabled:opacity-50",
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
+ selected ? "bg-background text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground",
+ )}
+ >
+ {option.label}
+ </button>
+ );
+ })}
+ </div>
+ );
+}
+
+/** A model (or any item) that is on or off, as a chip that toggles on click. */
+export function ToggleChip({
+ on,
+ label,
+ hint,
+ disabled,
+ onToggle,
+}: {
+ on: boolean;
+ label: string;
+ hint?: string;
+ disabled?: boolean;
+ onToggle: () => void;
+}) {
+ return (
+ <button
+ type="button"
+ role="switch"
+ aria-checked={on}
+ title={hint}
+ disabled={disabled}
+ onClick={onToggle}
+ className={cn(
+ "inline-flex h-7 max-w-[16rem] items-center gap-1.5 rounded-full border px-3 text-xs transition-colors disabled:opacity-50",
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
+ on
+ ? "border-accent/50 bg-accent-soft text-foreground"
+ : "border-border/70 text-muted-foreground hover:text-foreground",
+ )}
+ >
+ <span
+ aria-hidden="true"
+ className={cn("h-1.5 w-1.5 shrink-0 rounded-full", on ? "bg-accent" : "bg-border-strong")}
+ />
+ <span className="truncate">{label}</span>
+ </button>
+ );
+}
+
+/** Rarely needed settings, folded behind one quiet line. */
+export function Disclosure({
+ label,
+ children,
+ defaultOpen = false,
+ testId,
+}: {
+ label: ReactNode;
+ children: ReactNode;
+ defaultOpen?: boolean;
+ testId?: string;
+}) {
+ const [open, setOpen] = useState(defaultOpen);
+ return (
+ <div data-testid={testId}>
+ <button
+ type="button"
+ aria-expanded={open}
+ onClick={() => setOpen((value) => !value)}
+ className="inline-flex items-center gap-1.5 py-2 text-sm text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
+ >
+ <ChevronRight aria-hidden="true" className={cn("h-4 w-4 transition-transform motion-reduce:transition-none", open && "rotate-90")} />
+ {label}
+ </button>
+ {open ? <div className="pt-2">{children}</div> : null}
+ </div>
+ );
+}
+
+/** A status line: a small dot and a few words. */
+export function StatusLine({ tone, children }: { tone: "ok" | "off" | "warn" | "error"; children: ReactNode }) {
+ return (
+ <span className="inline-flex min-w-0 items-center gap-1.5 text-sm text-muted-foreground">
+ <span
+ aria-hidden="true"
+ className={cn(
+ "h-1.5 w-1.5 shrink-0 rounded-full",
+ tone === "ok" && "bg-success",
+ tone === "off" && "bg-border-strong",
+ tone === "warn" && "bg-warning",
+ tone === "error" && "bg-destructive",
+ )}
+ />
+ <span className="truncate">{children}</span>
+ </span>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/views/apikeys/settingsUi.tsx b/jarvis/ui/web/frontend/src/views/apikeys/settingsUi.tsx
deleted file mode 100644
index 594f347f9d..0000000000
--- a/jarvis/ui/web/frontend/src/views/apikeys/settingsUi.tsx
+++ /dev/null
@@ -1,338 +0,0 @@
-import type { ComponentPropsWithoutRef, ReactNode } from "react";
-import { cn } from "@/lib/utils";
-
-/**
- * The compact settings grammar of the provider page.
- *
- * A section is a muted one-line title (with an optional action on the right)
- * above one card. A row inside the card is a title and a short explanation on
- * the left and its control on the right; on a narrow window the control drops
- * under the text. Explanations belong to rows, never to section titles.
- */
-export function SettingsSection({
- title,
- icon,
- headerAction,
- plain = false,
- children,
- className,
- ...props
-}: Omit<ComponentPropsWithoutRef<"section">, "title"> & {
- title: ReactNode;
- icon?: ReactNode;
- headerAction?: ReactNode;
- /** No card around the children (they bring their own surfaces). */
- plain?: boolean;
- children: ReactNode;
-}) {
- return (
- <section {...props} className={cn("space-y-2.5", className)}>
- <div className="flex min-h-7 items-center justify-between gap-4 px-1">
- <h2 className="flex min-h-7 min-w-0 items-center gap-2 text-sm font-normal text-foreground/70">
- {icon}
- <span className="truncate">{title}</span>
- </h2>
- {headerAction ? <div className="flex min-w-7 shrink-0 items-center justify-end gap-1">{headerAction}</div> : null}
- </div>
- {plain ? children : <SettingsGroup>{children}</SettingsGroup>}
- </section>
- );
-}
-
-/** The card surface: rounded, hairline border, rows divided by hairlines. */
-export function SettingsGroup({
- divided = true,
- className,
- ...props
-}: ComponentPropsWithoutRef<"div"> & { divided?: boolean }) {
- return (
- <div
- {...props}
- className={cn(
- "relative overflow-hidden rounded-xl border border-border/60 bg-card/40 text-foreground",
- divided && "[&>*+*]:border-t [&>*+*]:border-border/50",
- className,
- )}
- />
- );
-}
-
-export function SettingsRow({
- title,
- description,
- status,
- control,
- children,
- className,
- ...props
-}: Omit<ComponentPropsWithoutRef<"div">, "title"> & {
- title: ReactNode;
- description?: ReactNode;
- /** A live state line under the description ("Authenticated as …"). */
- status?: ReactNode;
- control?: ReactNode;
- /** Full-width content under the row (an input, a list). */
- children?: ReactNode;
-}) {
- return (
- <div {...props} data-slot="settings-row" className={cn("px-4 py-3", className)}>
- <div className="flex flex-col gap-3 sm:grid sm:grid-cols-[minmax(0,1fr)_minmax(10rem,auto)] sm:items-center sm:gap-8">
- <div className="min-w-0 space-y-1">
- <h3 className="flex min-h-5 items-center gap-1.5 text-sm font-medium text-foreground">{title}</h3>
- {description ? (
- <p className="max-w-xl text-xs leading-normal text-muted-foreground/80">{description}</p>
- ) : null}
- {status ? <div className="pt-0.5 text-xs text-muted-foreground">{status}</div> : null}
- </div>
- {control ? (
- <div className="flex w-full min-w-0 shrink-0 items-center gap-2 sm:w-auto sm:justify-end">
- {control}
- </div>
- ) : null}
- </div>
- {children ? <div className="pt-3">{children}</div> : null}
- </div>
- );
-}
-
-/**
- * A list beside the selected item's settings, inside one card. The list sits
- * on a slightly darker ground; both halves scroll on their own once the card
- * reaches its height.
- */
-export function MasterDetail({
- list,
- detail,
- testId,
-}: {
- list: ReactNode;
- detail: ReactNode;
- testId?: string;
-}) {
- return (
- <SettingsGroup
- divided={false}
- data-testid={testId}
- className="md:grid md:h-[min(40rem,calc(100dvh-14rem))] md:min-h-[26rem] md:grid-cols-[17rem_minmax(0,1fr)]"
- >
- <div className="border-b border-border/60 bg-secondary/30 md:min-h-0 md:overflow-y-auto md:border-b-0 md:border-r scrollbar-jarvis">
- <div className="divide-y divide-border/50">{list}</div>
- </div>
- <div className="min-w-0 md:min-h-0 md:overflow-y-auto scrollbar-jarvis">
- <div className="space-y-6 p-4">{detail}</div>
- </div>
- </SettingsGroup>
- );
-}
-
-/** One entry of a `MasterDetail` list: mark, name, version, status, and a switch. */
-export function ListRow({
- icon,
- name,
- version,
- status,
- dot,
- selected,
- dimmed,
- onSelect,
- trailing,
- testId,
-}: {
- icon: ReactNode;
- name: string;
- version?: string | null;
- status: ReactNode;
- /** Only trouble gets a dot; a healthy row reads fine from its text. */
- dot?: "warning" | "error" | null;
- selected: boolean;
- dimmed: boolean;
- onSelect: () => void;
- trailing?: ReactNode;
- testId?: string;
-}) {
- return (
- <div
- data-testid={testId}
- className={cn(
- "group flex min-h-[4.5rem] items-center gap-3 px-4 py-3 transition-colors",
- selected ? "bg-secondary" : "hover:bg-secondary/50",
- )}
- >
- <div
- className={cn(
- "relative flex min-w-0 flex-1 items-start gap-3 rounded-md text-left transition-opacity",
- dimmed && !selected && "opacity-60 group-hover:opacity-100",
- )}
- >
- <button
- type="button"
- className="absolute inset-0 cursor-pointer rounded-md outline-none focus-visible:ring-2 focus-visible:ring-ring"
- onClick={onSelect}
- aria-label={name}
- aria-pressed={selected}
- />
- <span className="pointer-events-none mt-0.5 flex shrink-0">{icon}</span>
- <span className="pointer-events-none min-w-0 flex-1">
- <span className="flex min-w-0 items-center gap-2">
- <span className="truncate text-sm font-medium text-foreground">{name}</span>
- {version ? <code className="max-w-24 shrink-0 truncate text-xs text-muted-foreground">{version}</code> : null}
- </span>
- <span className="mt-0.5 flex items-start gap-1.5 text-xs leading-normal text-muted-foreground/80">
- {dot ? (
- <span className="flex h-[1.45em] shrink-0 items-center">
- <span
- aria-hidden="true"
- className={cn("h-1.5 w-1.5 rounded-full", dot === "error" ? "bg-destructive" : "bg-warning")}
- />
- </span>
- ) : null}
- <span className="line-clamp-2 [overflow-wrap:anywhere]">{status}</span>
- </span>
- </span>
- </div>
- {trailing ? <span className="flex h-5 shrink-0 items-center">{trailing}</span> : null}
- </div>
- );
-}
-
-/**
- * A small segmented choice ("Subscription | API key"). Each option is a radio:
- * exactly one is picked, and arrow keys are not needed for two or three.
- */
-export function Segmented<T extends string>({
- value,
- options,
- onChange,
- label,
- disabled,
- testId,
-}: {
- value: T;
- options: { value: T; label: string; disabled?: boolean }[];
- onChange: (value: T) => void;
- label: string;
- disabled?: boolean;
- testId?: string;
-}) {
- return (
- <div
- role="radiogroup"
- aria-label={label}
- data-testid={testId}
- className="inline-flex shrink-0 rounded-lg border border-border/60 bg-card/40 p-0.5"
- >
- {options.map((option) => (
- <button
- key={option.value}
- type="button"
- role="radio"
- aria-checked={value === option.value}
- disabled={disabled || option.disabled}
- onClick={() => value !== option.value && onChange(option.value)}
- className={cn(
- "h-7 rounded-md px-3 text-sm font-medium transition-colors",
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
- value === option.value ? "bg-secondary text-foreground" : "text-muted-foreground hover:text-foreground",
- )}
- >
- {option.label}
- </button>
- ))}
- </div>
- );
-}
-
-/**
- * A list of models inside a section card: name, id, a short note, and one
- * control per row (a visibility switch, or the pick mark of a single choice).
- * The header line carries a count and an optional bulk action.
- */
-export function ModelList({
- header,
- action,
- children,
- testId,
-}: {
- header: ReactNode;
- action?: ReactNode;
- children: ReactNode;
- testId?: string;
-}) {
- return (
- <SettingsGroup divided={false} data-testid={testId}>
- <div className="flex min-h-10 items-center justify-between gap-4 border-b border-border/50 px-4 py-2 text-xs text-muted-foreground">
- <span>{header}</span>
- {action}
- </div>
- <ul className="max-h-[22rem] overflow-y-auto py-1 scrollbar-jarvis">{children}</ul>
- </SettingsGroup>
- );
-}
-
-export function ModelListRow({
- name,
- id,
- note,
- control,
- muted,
- onClick,
- selected,
- disabled,
-}: {
- name: string;
- id?: string;
- note?: string | null;
- control: ReactNode;
- muted?: boolean;
- /** A single-choice list makes the whole row the hit target. */
- onClick?: () => void;
- selected?: boolean;
- disabled?: boolean;
-}) {
- const body = (
- <>
- <span className={cn("flex min-w-0 flex-1 items-baseline gap-2", muted && "opacity-60")}>
- <span className="truncate text-sm text-foreground">{name}</span>
- {id && id !== name ? <code className="truncate text-xs text-muted-foreground">{id}</code> : null}
- </span>
- {note ? <span className="hidden shrink-0 text-xs text-muted-foreground sm:inline">{note}</span> : null}
- <span className="flex h-5 shrink-0 items-center">{control}</span>
- </>
- );
- return (
- <li>
- {onClick ? (
- <button
- type="button"
- role="radio"
- aria-checked={Boolean(selected)}
- aria-label={name}
- disabled={disabled}
- onClick={onClick}
- className={cn(
- "flex w-full items-center gap-3 px-4 py-2 text-left transition-colors",
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring disabled:cursor-not-allowed",
- selected ? "bg-secondary/70" : "hover:bg-secondary/40",
- )}
- >
- {body}
- </button>
- ) : (
- <div className="flex items-center gap-3 px-4 py-2">{body}</div>
- )}
- </li>
- );
-}
-
-/** The detail pane's title line: mark and name, and the version on the right. */
-export function DetailHeader({ icon, name, version }: { icon: ReactNode; name: string; version?: string | null }) {
- return (
- <div className="flex min-h-7 items-center justify-between gap-4 px-1">
- <h2 className="flex min-w-0 items-center gap-2 text-sm font-normal text-foreground/70">
- {icon}
- <span className="truncate">{name}</span>
- </h2>
- {version ? <code className="truncate text-xs text-muted-foreground">{version}</code> : null}
- </div>
- );
-}