Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Studio: API examples behind one tab row, an access group, API page fixes (#15467)
Michael Han9fb0221c3df3
diff --git a/studio/frontend/src/components/app-sidebar.tsx b/studio/frontend/src/components/app-sidebar.tsxindex 77abdc00502..c6266fca97b 100644--- a/studio/frontend/src/components/app-sidebar.tsx+++ b/studio/frontend/src/components/app-sidebar.tsx@@ -1,6 +1,7 @@// SPDX-License-Identifier: AGPL-3.0-only// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0+import { BrushCleaningIcon } from "@/lib/brush-cleaning-icon";import { ChevronDownStandardIcon } from "@/lib/chevron-icons";import {Sidebar,@@ -128,7 +129,6 @@ import {Logout05Icon,MoreHorizontalIcon,MoreVerticalIcon,- PaintBrush02Icon,Search01Icon,PinIcon,PinOffIcon,@@ -355,7 +355,7 @@ const SETTINGS_TAB_MENU_ITEMS: Record<{ icon: typeof ZapIcon; labelKey: TranslationKey }> = {profile: { icon: UserCircleIcon, labelKey: "settings.tabs.profile" },- appearance: { icon: PaintBrush02Icon, labelKey: "settings.tabs.appearance" },+ appearance: { icon: BrushCleaningIcon, labelKey: "settings.tabs.appearance" },resources: { icon: CpuIcon, labelKey: "settings.tabs.resources" },chat: { icon: MessageCircleIcon, labelKey: "settings.tabs.chat" },connections: { icon: CloudIcon, labelKey: "settings.tabs.connections" },diff --git a/studio/frontend/src/features/api-monitor/api-monitor-page.tsx b/studio/frontend/src/features/api-monitor/api-monitor-page.tsxindex 5a4f9fd5fd8..dd8cb3b27bf 100644--- a/studio/frontend/src/features/api-monitor/api-monitor-page.tsx+++ b/studio/frontend/src/features/api-monitor/api-monitor-page.tsx@@ -32,33 +32,31 @@ import {import { useIsAccountOwner } from "@/features/auth";import {loadLanAccess,+ loadMultiModelEnabled,publishLanUrls,useSettingsDialogStore,} from "@/features/settings";// Not through the barrel: these pull in chat, which every barrel importer would then load.-import { RAISED_SURFACE } from "@/features/library/surface";+import {+ type ApiExampleKind,+ ApiExampleTabNav,+} from "@/features/settings/components/api-example-tabs";import { AudioApiExamples } from "@/features/settings/components/audio-api-examples";import { DecisionApiSection } from "@/features/settings/components/decision-api-section";import { MediaApiExamples } from "@/features/settings/components/media-api-examples";-import {- UsageExamples,- useApiTunnelPref,-} from "@/features/settings/components/usage-examples";+import { useApiTunnelPref } from "@/features/settings/components/usage-examples";import { remoteApiOrigin } from "@/features/settings/api/remote-access-state";import { getApiBase, isTauri } from "@/lib/api-base";import { copyToClipboard } from "@/lib/copy-to-clipboard";-import { AiSpeechIcon, MessageCircleIcon } from "@/lib/hugeicons-derived";import { Tick02Icon } from "@/lib/tick-icon";import { cn } from "@/lib/utils";import {ApiIcon,ArrowDataTransferVerticalIcon,Cancel01Icon,+ Clock01Icon,CodeIcon,- BotIcon,ComputerTerminal01Icon,- Image01Icon,- TaskDone01Icon,Delete02Icon,FileSearchIcon,FlashIcon,@@ -67,7 +65,6 @@ import {RemoveCircleIcon,Search01Icon,Settings02Icon,- Timer01Icon,} from "@hugeicons/core-free-icons";import { Copy01Icon } from "@/lib/copy-icon";import { PauseIcon } from "@/lib/media-control-icons";@@ -315,6 +312,55 @@ function openApiSettings(): void {useSettingsDialogStore.getState().openDialog("api-keys");}+function MultiModelHint({+ servedCount,+}: {+ servedCount: number;+}): ReactElement | null {+ const keepLoaded = useChatRuntimeStore((s) => s.keepModelsLoaded);+ const isOwner = useIsAccountOwner();+ // Store defaults to off: without the read the hint flashes for users who have it on.+ const [known, setKnown] = useState(false);+ useEffect(() => {+ let cancelled = false;+ loadMultiModelEnabled("Failed to read the multiple models setting").then(+ (enabled) => {+ if (cancelled) return;+ useChatRuntimeStore.getState().setKeepModelsLoaded(enabled);+ setKnown(true);+ },+ () => undefined,+ );+ return () => {+ cancelled = true;+ };+ }, []);+ if (!known || keepLoaded || servedCount > 1) return null;+ return (+ <>+ {" · "}+ {isOwner ? (+ <>+ Enable loading multiple models in{" "}+ <button+ type="button"+ className="font-medium text-foreground underline underline-offset-2 hover:text-primary"+ onClick={() =>+ useSettingsDialogStore.getState().openDialog("resources", {+ scrollTarget: "resources-model-memory",+ })+ }+ >+ Settings+ </button>+ </>+ ) : (+ "One model at a time"+ )}+ </>+ );+}+function Stat({label,value,@@ -422,7 +468,7 @@ function Fact({<HugeiconsIconicon={icon}strokeWidth={1.75}- className="size-3.5 shrink-0 text-muted-foreground"+ className="size-[1em] shrink-0 text-muted-foreground"/>) : null}{children}@@ -587,7 +633,7 @@ const RequestRow = memo(function RequestRow({}><HugeiconsIcon- icon={Timer01Icon}+ icon={Clock01Icon}strokeWidth={1.75}className="size-3"/>@@ -860,8 +906,6 @@ function RequestDetail({);}-type QuickStartKind = "chat" | "media" | "audio" | "decision" | "agents";-function QuickStart({baseUrl,model,@@ -870,18 +914,8 @@ function QuickStart({model: string | null;}): ReactElement {const choices = useApiExampleChoices(baseUrl, "curl");- const isOwner = useIsAccountOwner();- const [useTunnel, setUseTunnel] = useApiTunnelPref();- const [kind, setKind] = useState<QuickStartKind>("chat");- const kinds: { id: QuickStartKind; label: string; icon: IconSvgElement }[] = [- { id: "chat", label: "Chat", icon: MessageCircleIcon },- { id: "media", label: "Images / Video", icon: Image01Icon },- { id: "audio", label: "Audio", icon: AiSpeechIcon },- ...(isOwner- ? [{ id: "decision" as const, label: "Decision", icon: TaskDone01Icon }]- : []),- { id: "agents", label: "Agents", icon: BotIcon },- ];+ const [useTunnel] = useApiTunnelPref();+ const [kind, setKind] = useState<ApiExampleKind>("chat");return (<div className="flex flex-col items-center gap-4 px-6 py-12 text-center"><span className="flex size-10 items-center justify-center icon-disc text-muted-foreground">@@ -901,32 +935,7 @@ function QuickStart({: "Load a model, then send a request to see it here."}</p></div>- <nav aria-label="Example" className="flex flex-wrap justify-center gap-1">- {kinds.map((entry) => (- <button- key={entry.id}- type="button"- aria-current={entry.id === kind ? "page" : undefined}- onClick={() => setKind(entry.id)}- className={cn(- "flex h-9 shrink-0 items-center gap-2 rounded-full px-3.5 font-heading text-ui-15 text-foreground/80 transition-colors hover:text-foreground",- // On a card, so a step above it, not the card colour.- entry.id === kind &&- cn(- RAISED_SURFACE,- "font-medium text-foreground dark:bg-accent",- ),- )}- >- <HugeiconsIcon- icon={entry.icon}- strokeWidth={1.75}- className="size-4 shrink-0"- />- {entry.label}- </button>- ))}- </nav>+ <ApiExampleTabNav kind={kind} onChange={setKind} className="justify-center" />{kind === "chat" ? (<div className="w-full max-w-2xl text-left"><ApiExampleBox@@ -946,14 +955,8 @@ function QuickStart({<MediaApiExamples useTunnel={useTunnel} showHeading={false} />) : kind === "audio" ? (<AudioApiExamples useTunnel={useTunnel} showHeading={false} />- ) : kind === "decision" ? (- <DecisionApiSection showHeading={false} />) : (- <UsageExamples- useTunnel={useTunnel}- onUseTunnelChange={setUseTunnel}- agentsOnly={true}- />+ <DecisionApiSection showHeading={false} />)}</div>)}@@ -1418,7 +1421,8 @@ export function ApiMonitorPage(): ReactElement {pinOnClick={true}hoverClassName="rounded-full transition-colors group-hover:bg-muted dark:group-hover:bg-chat-icon-bg-hover"padX={2}- className="-my-1 -ml-2 h-6 min-w-(--full) [--icon-size:--spacing(3.5)] [&>button]:rounded-full"+ fitContent={true}+ className="-mx-2 -my-1 h-6 font-sans text-ui-12 tabular-nums [--icon-size:--spacing(3.5)] [&>button]:rounded-full"used={used}total={windowSize}promptTokens={last?.prompt_tokens ?? undefined}@@ -1438,7 +1442,7 @@ export function ApiMonitorPage(): ReactElement {</dl><dl className={FACT_CELL}>{rowStats.avgDurationMs != null ? (- <Fact label="Total time, average per request" icon={Timer01Icon}>+ <Fact label="Total time, average per request" icon={Clock01Icon}><span className="tabular-nums">{formatDuration(rowStats.avgDurationMs)}</span>@@ -1461,10 +1465,12 @@ export function ApiMonitorPage(): ReactElement {};return (<>- {/* Model picker where Chat keeps it; sticky, so the log scrolls under it. */}+ {/* In the macOS titlebar row like Chat's header; click-through so the row still drags. */}<divclassName={cn(- "sticky top-0 z-30 flex min-h-[calc(48px*var(--ui-space-scale,1))] shrink-0 items-start bg-background pt-[var(--studio-chat-header-padding-top,11px)]",+ "pointer-events-none sticky top-0 z-40 flex min-h-[calc(48px*var(--ui-space-scale,1))] shrink-0 items-start bg-background pt-[var(--studio-chat-header-padding-top,11px)]",+ !isMobileShell &&+ "-mt-[calc(var(--studio-non-chat-content-top-inset,var(--studio-content-top-inset,0px))-var(--studio-content-top-inset,0px))]",isMobileShell? "pl-12": pinned@@ -1474,7 +1480,7 @@ export function ApiMonitorPage(): ReactElement {: "pl-[calc(0.5rem*var(--ui-space-scale,1)+max(0px,var(--studio-mac-traffic-light-inset,0px)-var(--sidebar-width-icon,3rem)))]",)}>- <div data-tour="api-toolbar" className="flex min-w-0 max-w-full">+ <div data-tour="api-toolbar" className="pointer-events-auto flex min-w-0 max-w-full"><ApiModelLoadControlsruntime={runtime}activeModel={data?.active_model}@@ -1646,6 +1652,7 @@ export function ApiMonitorPage(): ReactElement {{served.length === 0 ? (<p className="text-ui-12 text-muted-foreground">No models loaded+ <MultiModelHint servedCount={0} /></p>) : (<div className="@container/served flex flex-col gap-2">@@ -1653,13 +1660,15 @@ export function ApiMonitorPage(): ReactElement {{served.length === 1? "1 model answering requests": `${served.length} models answering requests`}+ <MultiModelHint servedCount={served.length} /></p>- <div className="flex flex-col gap-3 @3xl/served:grid @3xl/served:grid-cols-[minmax(0,max-content)_auto_auto_auto_auto_1fr] @3xl/served:items-center @3xl/served:gap-x-6 @3xl/served:gap-y-1.5">+ {/* Not fixed widths: they left a short value's slack before the next column. */}+ <div className="flex flex-col gap-3 @3xl/served:grid @3xl/served:grid-cols-[minmax(0,max-content)_auto_auto_auto_auto_1fr] @3xl/served:items-center @3xl/served:gap-x-10 @3xl/served:gap-y-1.5">{served.map((model) => (// A subgrid, not `contents`: the row needs a box (gaps included) to hover.<divkey={model.checkpoint}- className="group/row flex flex-wrap items-center gap-x-3 gap-y-1 @md/served:gap-x-4 @3xl/served:col-span-full @3xl/served:grid @3xl/served:grid-cols-subgrid @3xl/served:gap-x-6"+ className="group/row flex flex-wrap items-center gap-x-3 gap-y-1 @md/served:gap-x-4 @3xl/served:col-span-full @3xl/served:grid @3xl/served:grid-cols-subgrid @3xl/served:gap-x-10"><span className="order-1 flex min-w-0 flex-1 items-center gap-1 text-ui-12 @max-3xl/served:basis-full @max-3xl/served:items-start @3xl/served:order-none"><spandiff --git a/studio/frontend/src/features/api-monitor/components/saved-model-settings.tsx b/studio/frontend/src/features/api-monitor/components/saved-model-settings.tsxindex 2375d11a3a2..64daddfaf12 100644--- a/studio/frontend/src/features/api-monitor/components/saved-model-settings.tsx+++ b/studio/frontend/src/features/api-monitor/components/saved-model-settings.tsx@@ -195,9 +195,8 @@ export function SavedModelSettingsPanel(): ReactElement {Saved load settings</h2><p className="text-sm text-muted-foreground">- A request that names one of these models loads it with the settings- saved in its Run settings. Other models load with app defaults.- Forgetting an entry also clears it from the picker.+ Requests naming these models load them with their saved Run settings.+ Forgetting one also removes it from the picker.</p></div>diff --git a/studio/frontend/src/features/chat/components/context-usage-bar.tsx b/studio/frontend/src/features/chat/components/context-usage-bar.tsxindex a659058fdac..7dc24a3e73c 100644--- a/studio/frontend/src/features/chat/components/context-usage-bar.tsx+++ b/studio/frontend/src/features/chat/components/context-usage-bar.tsx@@ -142,8 +142,10 @@ export const ContextUsageBar: FC</** Side padding of the face, in --spacing units; the widths below count it. */padX?: number;ringFirst?: boolean;+ /** Text width, never compacting: the ch widths assume the mono face. */+ fitContent?: boolean;}-> = ({ className, compactUnknownAsIcon = false, pinOnClick = false, hoverClassName, padX = 2.5, ringFirst = false, ...input }) => {+> = ({ className, compactUnknownAsIcon = false, pinOnClick = false, hoverClassName, padX = 2.5, ringFirst = false, fitContent = false, ...input }) => {const pin = useClickPin(pinOnClick);const state = deriveContextUsageBar(input);if (!state) return null;@@ -172,28 +174,39 @@ export const ContextUsageBar: FC<{/* The header squeezes this wrapper; the button inside takes only the face it shows. */}<divstyle={- {- "--full": fullWidth,- "--compact": compactWidth,- gridTemplateColumns: "minmax(var(--compact), var(--full))",- } as CSSProperties+ fitContent+ ? undefined+ : ({+ "--full": fullWidth,+ "--compact": compactWidth,+ gridTemplateColumns: "minmax(var(--compact), var(--full))",+ } as CSSProperties)}- className={cn("grid shrink! items-center font-mono text-ui-13", className)}+ className={cn(+ fitContent ? "flex items-center" : "grid shrink! items-center",+ "font-mono text-ui-13",+ className,+ )}><TooltipTrigger asChild><buttontype="button"{...pin?.trigger}aria-label={state.label}- style={{- width:- "calc(clamp(0px, (100% - var(--full) + 1px) * 999, var(--full)) + clamp(0px, (var(--full) - 100% - 1px) * 999, var(--compact)))",- }}+ style={+ fitContent+ ? undefined+ : {+ width:+ "calc(clamp(0px, (100% - var(--full) + 1px) * 999, var(--full)) + clamp(0px, (var(--full) - 100% - 1px) * 999, var(--compact)))",+ }+ }className={cn("group grid h-full items-center justify-self-end overflow-hidden rounded-[10px] text-chat-icon-fg tabular-nums whitespace-nowrap hover:text-chat-icon-fg-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","[--track:rgb(0_0_0_/_calc(0.14*var(--contrast-wash-gain,1)))] dark:[--track:rgb(255_255_255_/_calc(0.2*var(--contrast-wash-gain,1)))]",)}>+ {fitContent ? null : (<spanclassName="col-start-1 row-start-1 flex h-full items-center justify-center overflow-hidden"style={{ width: "clamp(0px, (var(--full) - 100% - 1px) * 999, 100%)" }}@@ -206,11 +219,15 @@ export const ContextUsageBar: FC<<span className={cn("flex h-full shrink-0 items-center", hover)} style={padStyle}><Face face={compactFace} /></span>)}</span>+ )}<spanclassName="col-start-1 row-start-1 h-full overflow-hidden"- style={{ width: "clamp(0px, (100% - var(--full) + 1px) * 999, var(--full))" }}+ style={fitContent ? undefined : { width: "clamp(0px, (100% - var(--full) + 1px) * 999, var(--full))" }}>- <span className={cn("flex h-full w-(--full) items-center gap-2", hover)} style={padStyle}>+ <span+ className={cn("flex h-full items-center", fitContent ? "gap-1.5" : "w-(--full) gap-2", hover)}+ style={padStyle}+ >{showRing && ringFirst ? <UsageRing percent={percent} stroke={severity.stroke} /> : null}<Face face={face} />{showRing && !ringFirst ? <UsageRing percent={percent} stroke={severity.stroke} /> : null}diff --git a/studio/frontend/src/features/hub/catalog/download-card.tsx b/studio/frontend/src/features/hub/catalog/download-card.tsxindex 6716e563084..86cc734a12e 100644--- a/studio/frontend/src/features/hub/catalog/download-card.tsx+++ b/studio/frontend/src/features/hub/catalog/download-card.tsx@@ -116,7 +116,7 @@ export function ModelRunActionButton({) : (<><PlayIcon strokeWidth={2} className="[&_path]:fill-current" />- Run+ <span className="hub-run-action-label">Run</span></>)}</button>diff --git a/studio/frontend/src/features/hub/hub.css b/studio/frontend/src/features/hub/hub.cssindex 47b3ba57d1d..0550115e900 100644--- a/studio/frontend/src/features/hub/hub.css+++ b/studio/frontend/src/features/hub/hub.css@@ -1200,8 +1200,6 @@/* The play glyph's empty right side reads as padding on the left, so the right gets more. */padding: calc(0.625rem * var(--ui-space-scale, 1)) calc(1rem * var(--ui-space-scale, 1))calc(0.625rem * var(--ui-space-scale, 1)) calc(0.875rem * var(--ui-space-scale, 1));- /* Half a pixel more on top: centred by its line box, the cap-height label sits that much high. */- padding-block: calc(0.625rem * var(--ui-space-scale, 1) + 0.5px) calc(0.625rem * var(--ui-space-scale, 1) - 0.5px);margin-inline-start: calc(0.5rem * var(--ui-space-scale, 1));font-size: calc(0.9375rem * var(--ui-font-scale, 1));font-weight: 600;@@ -1214,9 +1212,15 @@0 1px 2px color-mix(in srgb, var(--status-success) 22%, transparent);}- /* Icons add no height. The nudge undoes the label's half pixel, so the triangle stays centred. */+ /* Optical centring: the filled glyph's ink sits low. */.hub-run-action-btn svg {margin-block: calc(-0.625rem * var(--ui-space-scale, 1));+ translate: 0 -0.25px;+ }++ /* A transform, not padding: text snaps to whole pixels. */+ .hub-run-action-label {+ display: inline-block;translate: 0 -0.5px;}diff --git a/studio/frontend/src/features/settings/components/api-example-tabs.tsx b/studio/frontend/src/features/settings/components/api-example-tabs.tsxnew file mode 100644index 00000000000..99d4d666753--- /dev/null+++ b/studio/frontend/src/features/settings/components/api-example-tabs.tsx@@ -0,0 +1,210 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++import { useIsAccountOwner } from "@/features/auth";+import { type TranslationKey, useT } from "@/i18n";+// Not through the barrel: it pulls in chat, which every barrel importer would then load.+import { RAISED_SURFACE } from "@/features/library/surface";+import { AiSpeechIcon, MessageCircleIcon } from "@/lib/hugeicons-derived";+import { cn } from "@/lib/utils";+import {+ BotIcon,+ Image01Icon,+ TaskDone01Icon,+} from "@hugeicons/core-free-icons";+import { HugeiconsIcon, type IconSvgElement } from "@hugeicons/react";+import {+ type ReactElement,+ type ReactNode,+ useEffect,+ useRef,+ useState,+} from "react";+import type {+ KeylessApiAccessExposure,+ KeylessApiAccessScope,+} from "../api/keyless-api-access";+import { scrollIntoPane } from "../lib/scroll-into-pane";+import {+ type SettingsScrollTarget,+ useSettingsDialogStore,+} from "../stores/settings-dialog-store";+import { AudioApiExamples } from "./audio-api-examples";+import { DecisionApiSection } from "./decision-api-section";+import { MediaApiExamples } from "./media-api-examples";+import { UsageExamples } from "./usage-examples";++export type ApiExampleKind = "chat" | "media" | "audio" | "decision" | "agents";++export function useApiExampleKinds(): {+ id: ApiExampleKind;+ label: string;+ icon: IconSvgElement;+ /** Settings search target: the card is unmounted off its tab. */+ searchLabel?: TranslationKey;+}[] {+ const isOwner = useIsAccountOwner();+ return [+ { id: "chat", label: "Chat", icon: MessageCircleIcon },+ {+ id: "media",+ label: "Images / Video",+ icon: Image01Icon,+ searchLabel: "settings.apiKeys.mediaApi.title",+ },+ {+ id: "audio",+ label: "Audio",+ icon: AiSpeechIcon,+ searchLabel: "settings.apiKeys.audioApi.title",+ },+ ...(isOwner+ ? [+ {+ id: "decision" as const,+ label: "Decision",+ icon: TaskDone01Icon,+ searchLabel: "settings.apiKeys.decisionApi.title" as const,+ },+ { id: "agents" as const, label: "Agents", icon: BotIcon },+ ]+ : []),+ ];+}++export function ApiExampleTabNav({+ kind,+ onChange,+ className,+}: {+ kind: ApiExampleKind;+ onChange: (kind: ApiExampleKind) => void;+ className?: string;+}): ReactElement {+ const t = useT();+ const kinds = useApiExampleKinds();+ return (+ <nav aria-label="Example" className={cn("flex flex-wrap gap-1", className)}>+ {kinds.map((entry) => (+ <button+ key={entry.id}+ type="button"+ aria-current={entry.id === kind ? "page" : undefined}+ data-settings-label={+ entry.searchLabel ? t(entry.searchLabel) : undefined+ }+ onClick={() =>+ entry.id === "agents"+ ? useSettingsDialogStore.getState().openDialog("agents")+ : onChange(entry.id)+ }+ className={cn(+ "flex h-9 shrink-0 items-center gap-2 rounded-full px-3.5 font-heading text-ui-15 text-foreground/80 transition-colors hover:text-foreground",+ entry.id === kind &&+ cn(RAISED_SURFACE, "font-medium text-foreground dark:bg-accent"),+ )}+ >+ <HugeiconsIcon+ icon={entry.icon}+ strokeWidth={1.75}+ className="size-4 shrink-0"+ />+ {entry.label}+ </button>+ ))}+ </nav>+ );+}++const TAB_FOR_TARGET: Partial<Record<SettingsScrollTarget, ApiExampleKind>> = {+ "api-keys-media-api": "media",+ "api-keys-audio-api": "audio",+ "api-keys-decision-api": "decision",+};++function pinUntilUserScrolls(+ el: HTMLElement,+ target: SettingsScrollTarget,+): () => void {+ const observer = new ResizeObserver(() => scrollIntoPane(el));+ observer.observe(el.parentElement ?? el);+ const release = () => {+ observer.disconnect();+ useSettingsDialogStore.getState().consumeScrollTarget(target);+ };+ const timer = window.setTimeout(release, 1500);+ const events = ["wheel", "touchmove", "keydown"] as const;+ for (const name of events) {+ window.addEventListener(name, release, { passive: true });+ }+ return () => {+ observer.disconnect();+ window.clearTimeout(timer);+ for (const name of events) {+ window.removeEventListener(name, release);+ }+ };+}++export function ApiExamplesPanel({+ apiKey,+ useTunnel,+ onUseTunnelChange,+ keylessScope,+ keylessTools,+ keylessExposure,+}: {+ apiKey: string | null;+ useTunnel: boolean;+ onUseTunnelChange: (next: boolean) => void;+ keylessScope: KeylessApiAccessScope;+ keylessTools: boolean;+ keylessExposure: KeylessApiAccessExposure | null;+}): ReactElement {+ const isOwner = useIsAccountOwner();+ const [kind, setKind] = useState<ApiExampleKind>("chat");+ const panelRef = useRef<HTMLDivElement | null>(null);+ const scrollTarget = useSettingsDialogStore((s) => s.scrollTarget);+ // Picking the tab mounts the card that takes the request.+ useEffect(() => {+ const tab = scrollTarget ? TAB_FOR_TARGET[scrollTarget] : undefined;+ const el = panelRef.current;+ if (!(scrollTarget && tab && el)) return;+ if (tab === "decision" && !isOwner) return;+ setKind(tab);+ return pinUntilUserScrolls(el, scrollTarget);+ }, [scrollTarget, isOwner]);+ const keyless = { keylessScope, keylessExposure };+ return (+ <div ref={panelRef} className="flex min-w-0 scroll-mt-6 flex-col gap-4">+ <ApiExampleTabNav kind={kind} onChange={setKind} className="-ml-1" />+ {kind === "chat" ? (+ <UsageExamples+ part="chat"+ apiKey={apiKey}+ useTunnel={useTunnel}+ onUseTunnelChange={onUseTunnelChange}+ keylessScope={keylessScope}+ keylessTools={keylessTools}+ keylessExposure={keylessExposure}+ />+ ) : kind === "media" ? (+ <MediaApiExamples+ apiKey={apiKey}+ useTunnel={useTunnel}+ showHeading={false}+ {...keyless}+ />+ ) : kind === "audio" ? (+ <AudioApiExamples+ apiKey={apiKey}+ useTunnel={useTunnel}+ showHeading={false}+ {...keyless}+ />+ ) : (+ <DecisionApiSection showHeading={false} />+ )}+ </div>+ );+}diff --git a/studio/frontend/src/features/settings/components/api-jump-links.tsx b/studio/frontend/src/features/settings/components/api-jump-links.tsxdeleted file mode 100644index 379410b3fdc..00000000000--- a/studio/frontend/src/features/settings/components/api-jump-links.tsx+++ /dev/null@@ -1,91 +0,0 @@-// SPDX-License-Identifier: AGPL-3.0-only-// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0--import { useIsAccountOwner } from "@/features/auth";-import { useT } from "@/i18n";-import { AiSpeechIcon } from "@/lib/hugeicons-derived";-import { cn } from "@/lib/utils";-import {- BotIcon,- Image01Icon,- McpServerIcon,- TaskDone01Icon,-} from "@hugeicons/core-free-icons";-import { HugeiconsIcon } from "@hugeicons/react";-import {- type SettingsScrollTarget,- useSettingsDialogStore,-} from "../stores/settings-dialog-store";--export function ApiJumpLinks({ className }: { className?: string }) {- const t = useT();- const isOwner = useIsAccountOwner();- const links: {- key: string;- icon: typeof Image01Icon;- label: string;- target: SettingsScrollTarget;- ownerOnly?: boolean;- }[] = [- {- key: "media",- icon: Image01Icon,- label: t("settings.apiKeys.mediaApi.title"),- target: "api-keys-media-api",- },- {- key: "audio",- icon: AiSpeechIcon,- label: t("settings.apiKeys.audioApi.title"),- target: "api-keys-audio-api",- },- {- key: "decision",- icon: TaskDone01Icon,- label: t("settings.apiKeys.decisionApi.title"),- target: "api-keys-decision-api",- ownerOnly: true,- },- {- key: "agents",- icon: BotIcon,- label: t("settings.tabs.agents"),- target: "api-keys-agents",- },- {- key: "mcp",- icon: McpServerIcon,- label: "MCP",- target: "api-keys-mcp",- ownerOnly: true,- },- ];- return (- <nav- aria-label={t("settings.apiKeys.title")}- className={cn("flex min-w-0 flex-wrap items-center gap-2", className)}- >- {links- .filter((link) => isOwner || !link.ownerOnly)- .map((link) => (- <button- key={link.key}- type="button"- onClick={() =>- useSettingsDialogStore- .getState()- .openDialog("api-keys", { scrollTarget: link.target })- }- className="btn-fill group/jump inline-flex h-8 items-center gap-1.5 rounded-full px-3 text-ui-13 font-medium text-foreground/80 outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring"- >- <HugeiconsIcon- icon={link.icon}- strokeWidth={1.75}- className="size-3.5 shrink-0 text-muted-foreground transition-colors group-hover/jump:text-foreground"- />- {link.label}- </button>- ))}- </nav>- );-}diff --git a/studio/frontend/src/features/settings/components/decision-api-section.tsx b/studio/frontend/src/features/settings/components/decision-api-section.tsxindex 242a7d999ef..e10e13aa67a 100644--- a/studio/frontend/src/features/settings/components/decision-api-section.tsx+++ b/studio/frontend/src/features/settings/components/decision-api-section.tsx@@ -347,11 +347,25 @@ export function DecisionApiSection({}};+ // title, not aria-label, so the accessible name stays the visible text.+ const docsLink = (+ <a+ href={DOCS_URL}+ target="_blank"+ rel="noreferrer"+ title={t("settings.apiKeys.decisionApi.docsLabel")}+ className="inline-flex shrink-0 items-center gap-1 rounded-full font-medium text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"+ >+ {t("settings.apiKeys.decisionApi.docs")}+ <HugeiconsIcon icon={ArrowUpRight01Icon} className="size-3" />+ </a>+ );const header = (<div className="flex items-start justify-between gap-3"><div className="flex min-w-0 flex-col gap-1">- <div className="flex min-w-0 items-baseline gap-2">- {showHeading && (+ {/* Centred, not baseline: the h2 is a flex box, so its baseline is the icon's foot. */}+ {showHeading && (+ <div className="flex min-w-0 items-center gap-3"><h2 className="settings-heading flex items-center gap-2 text-base font-semibold font-heading"><HugeiconsIconicon={TaskDone01Icon}@@ -360,21 +374,12 @@ export function DecisionApiSection({/>{t("settings.apiKeys.decisionApi.title")}</h2>- )}- {/* title, not aria-label, so the accessible name stays the visible text. */}- <a- href={DOCS_URL}- target="_blank"- rel="noreferrer"- title={t("settings.apiKeys.decisionApi.docsLabel")}- className="inline-flex shrink-0 items-center gap-1 rounded-full px-1.5 py-0.5 text-ui-11 font-medium text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"- >- {t("settings.apiKeys.decisionApi.docs")}- <HugeiconsIcon icon={ArrowUpRight01Icon} className="size-3" />- </a>- </div>+ <span className="text-ui-11">{docsLink}</span>+ </div>+ )}<p className="text-xs leading-relaxed text-muted-foreground">{t("settings.apiKeys.decisionApi.description")}+ {showHeading ? null : <span className="ml-1.5 inline-flex align-baseline">{docsLink}</span>}</p></div>{settings ? (@@ -408,7 +413,7 @@ export function DecisionApiSection({</div>);const errorLine = error ? (- <p className="px-4 py-2.5 text-xs leading-snug text-destructive">{error}</p>+ <p className="py-2.5 text-xs leading-snug text-destructive">{error}</p>) : null;if (!settings) {@@ -418,7 +423,7 @@ export function DecisionApiSection({className="flex min-w-0 max-w-full flex-col gap-4">{header}- <div className="overflow-hidden rounded-xl border border-border/70">+ <div>{errorLine}</div></section>@@ -497,9 +502,9 @@ export function DecisionApiSection({>{header}- <div className="overflow-hidden rounded-xl border border-border/70">+ <div>{errorLine}- <div className={cn("px-4 py-1", error && "border-t border-border/60")}>+ <div className="py-1"><SettingsRowlabel={t("settings.apiKeys.decisionApi.enable")}description={@@ -749,8 +754,9 @@ export function DecisionApiSection({<buttontype="button"className="font-medium text-foreground underline underline-offset-2 hover:text-primary"+ // openDialog, not setActiveTab: the API page shows this card with no dialog open.onClick={() =>- useSettingsDialogStore.getState().setActiveTab("connections")+ useSettingsDialogStore.getState().openDialog("connections")}>{t("settings.apiKeys.decisionApi.openConnections")}diff --git a/studio/frontend/src/features/settings/components/keyless-api-access-link.tsx b/studio/frontend/src/features/settings/components/keyless-api-access-link.tsxindex c96a569f2f4..fee170b3d55 100644--- a/studio/frontend/src/features/settings/components/keyless-api-access-link.tsx+++ b/studio/frontend/src/features/settings/components/keyless-api-access-link.tsx@@ -4,30 +4,27 @@import { ChevronRightStandardIcon } from "@/lib/chevron-icons";import { HugeiconsIcon } from "@hugeicons/react";import { useSettingsDialogStore } from "../stores/settings-dialog-store";-import { SettingsSection } from "./settings-section";+import { SettingsRow } from "./settings-row";// The switches live on Remote & LAN, beside the exposure they depend on. English like that section.export function KeylessApiAccessLink() {return (- <SettingsSection- title="Keyless API access"+ <SettingsRow+ label="Keyless API access"description="Use Unsloth from other apps without creating an API key. Turn it on in Remote & LAN."- action={- <button- type="button"- onClick={() =>- useSettingsDialogStore- .getState()- .openDialog("remote-lan", { scrollTarget: "remote-lan-keyless" })- }- className="inline-flex items-center gap-1 rounded-full px-1.5 py-0.5 text-ui-11 font-medium text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"- >- Open in Remote & LAN- <HugeiconsIcon icon={ChevronRightStandardIcon} className="size-3" />- </button>- }>- {null}- </SettingsSection>+ <button+ type="button"+ onClick={() =>+ useSettingsDialogStore+ .getState()+ .openDialog("remote-lan", { scrollTarget: "remote-lan-keyless" })+ }+ className="inline-flex items-center gap-1 rounded-full px-1.5 py-0.5 text-ui-11 font-medium text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"+ >+ Open in Remote & LAN+ <HugeiconsIcon icon={ChevronRightStandardIcon} className="size-3" />+ </button>+ </SettingsRow>);}diff --git a/studio/frontend/src/features/settings/components/monitor-link.tsx b/studio/frontend/src/features/settings/components/monitor-link.tsxindex 8b324713e4c..b2a76934a83 100644--- a/studio/frontend/src/features/settings/components/monitor-link.tsx+++ b/studio/frontend/src/features/settings/components/monitor-link.tsx@@ -7,6 +7,7 @@ import { useApiMonitorOverlayStore } from "@/features/api-monitor/overlay-store"import { getApiMonitor } from "@/features/chat/api/chat-api";import type { ApiMonitorResponse } from "@/features/chat/types/api";import { useLocale, useT } from "@/i18n";+import { cn } from "@/lib/utils";import { ActivityIcon } from "@hugeicons/core-free-icons";import { ArrowRightIcon } from "lucide-react";import { HugeiconsIcon } from "@hugeicons/react";@@ -16,7 +17,11 @@ import { useSettingsDialogStore } from "../stores/settings-dialog-store";import { SettingsRow } from "./settings-row";import { SettingsSection } from "./settings-section";-export function MonitorLink(): ReactElement {+export function MonitorLink({+ hideHeading = false,+}: {+ hideHeading?: boolean;+} = {}): ReactElement {const navigate = useNavigate();const locale = useLocale();const t = useT();@@ -40,8 +45,11 @@ export function MonitorLink(): ReactElement {const recent = data?.entries.length ?? 0;return (- <SettingsSection title={t("settings.resources.liveMonitor.apiTitle")}>- <div className="flex flex-col pt-3">+ <SettingsSection+ title={t("settings.resources.liveMonitor.apiTitle")}+ hideHeading={hideHeading}+ >+ <div className={cn("flex flex-col", hideHeading ? "pt-2" : "pt-3")}><buttontype="button"onClick={() => {diff --git a/studio/frontend/src/features/settings/components/sidebar-menu-customizer.tsx b/studio/frontend/src/features/settings/components/sidebar-menu-customizer.tsxindex 24b460341e8..9ae159c70e9 100644--- a/studio/frontend/src/features/settings/components/sidebar-menu-customizer.tsx+++ b/studio/frontend/src/features/settings/components/sidebar-menu-customizer.tsx@@ -1,6 +1,7 @@// SPDX-License-Identifier: AGPL-3.0-only// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0+import { BrushCleaningIcon } from "@/lib/brush-cleaning-icon";import {CloudIcon,CpuIcon,@@ -9,7 +10,6 @@ import {HelpCircleIcon,Logout05Icon,Moon02Icon,- PaintBrush02Icon,PowerIcon,Settings02Icon,UserCircleIcon,@@ -33,7 +33,7 @@ const ITEM_META: Record<darkMode: { icon: Moon02Icon, labelKey: "settings.appearance.sidebarMenu.darkModeToggle" },guidedTour: { icon: CursorInfo02Icon, labelKey: "shell.navigation.guidedTour" },profile: { icon: UserCircleIcon, labelKey: "settings.tabs.profile" },- appearance: { icon: PaintBrush02Icon, labelKey: "settings.tabs.appearance" },+ appearance: { icon: BrushCleaningIcon, labelKey: "settings.tabs.appearance" },resources: { icon: CpuIcon, labelKey: "settings.tabs.resources" },chat: { icon: MessageCircleIcon, labelKey: "settings.tabs.chat" },connections: { icon: CloudIcon, labelKey: "settings.tabs.connections" },diff --git a/studio/frontend/src/features/settings/components/usage-examples.tsx b/studio/frontend/src/features/settings/components/usage-examples.tsxindex 87daacbf53c..abb606534ff 100644--- a/studio/frontend/src/features/settings/components/usage-examples.tsx+++ b/studio/frontend/src/features/settings/components/usage-examples.tsx@@ -523,9 +523,11 @@ export function UsageExamples({keylessExposure = null,agentsExtra = null,agentsOnly = false,+ part = "all",}: {apiKey?: string | null;agentsOnly?: boolean;+ part?: "all" | "chat";agentsExtra?: ReactNode;useTunnel: boolean;onUseTunnelChange: (next: boolean) => void;@@ -542,7 +544,7 @@ export function UsageExamples({const agentsRef = useRef<HTMLDivElement | null>(null);const mcpRef = useRef<HTMLDivElement | null>(null);useEffect(() => {- if (agentsOnly) return;+ if (agentsOnly || part !== "all") return;if (scrollTarget !== "api-keys-agents" && scrollTarget !== "api-keys-mcp") return;const target = scrollTarget;const section = (target === "api-keys-agents" ? agentsRef : mcpRef).current;@@ -564,7 +566,7 @@ export function UsageExamples({window.clearTimeout(timer);for (const name of events) window.removeEventListener(name, release);};- }, [scrollTarget, agentsOnly]);+ }, [scrollTarget, agentsOnly, part]);const cloudflareUrl = usePlatformStore((s) => s.cloudflareUrl);const serverUrl = usePlatformStore((s) => s.serverUrl);const secure = usePlatformStore((s) => s.secure);@@ -838,10 +840,12 @@ export function UsageExamples({<section className="flex min-w-0 max-w-full flex-col gap-4">{agentsOnly ? null : (<>- <h2 className="settings-heading flex items-center gap-2 text-base font-semibold font-heading">- <HugeiconsIcon icon={MessageCircleIcon} strokeWidth={1.75} className="size-[calc(18px*var(--ui-space-scale,1))] shrink-0 text-muted-foreground" />- {t("settings.apiKeys.usageExamples")}- </h2>+ {part === "all" ? (+ <h2 className="settings-heading flex items-center gap-2 text-base font-semibold font-heading">+ <HugeiconsIcon icon={MessageCircleIcon} strokeWidth={1.75} className="size-[calc(18px*var(--ui-space-scale,1))] shrink-0 text-muted-foreground" />+ {t("settings.apiKeys.usageExamples")}+ </h2>+ ) : null}{/* No model-auto-switch row: ModelAutoSwitchSection renders that setting just below. */}{cloudflareUrl ? (<div className="flex min-w-0 items-center justify-between gap-2 rounded-full border border-border px-4 py-2">@@ -901,6 +905,11 @@ export function UsageExamples({</button></div>) : null}+ {model ? null : (+ <p className="text-ui-11 leading-relaxed text-muted-foreground">+ {t("settings.apiKeys.usageNoModel")}+ </p>+ )}<ExampleTogglelabel={t("settings.apiKeys.exampleRequest")}variant="toggle"@@ -911,11 +920,6 @@ export function UsageExamples({}))}onChange={(next) => pickExample(exampleType(language, next))}/>- {model ? null : (- <p className="text-ui-11 leading-relaxed text-muted-foreground">- {t("settings.apiKeys.usageNoModel")}- </p>- )}<ExampleCodeBoxcode={snippets[lang]}language={shikiLang}@@ -934,126 +938,124 @@ export function UsageExamples({/></>)}- <div ref={agentsRef} className="flex min-w-0 scroll-mt-6 flex-col gap-2.5 pt-2">- <div className="flex items-center justify-between gap-3">- {agentsOnly ? (- <span />- ) : (- <h2 className="settings-heading flex items-center gap-2 text-base font-semibold font-heading">- <HugeiconsIcon icon={BotIcon} strokeWidth={1.75} className="size-[calc(18px*var(--ui-space-scale,1))] shrink-0 text-muted-foreground" />- {t("settings.tabs.agents")}- </h2>- )}- {/* Agents is owner-only (settings-tab-visibility.ts): other accounts would land- on General, so they get the agent's docs instead. The tab restores its agent- from this pref when it mounts. */}- {isOwner ? (- <button- type="button"- onClick={() => {- setAgentsTabAgent(agent);- // Off the API page there is no dialog to switch tabs in.- if (agentsOnly) useSettingsDialogStore.getState().openDialog("agents");- else useSettingsDialogStore.getState().setActiveTab("agents");- }}- className="inline-flex items-center gap-1 rounded-full px-1.5 py-0.5 text-ui-11 font-medium text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"- >- {t("settings.apiKeys.openAgentsTab")}- <HugeiconsIcon icon={ChevronRightStandardIcon} className="size-3" />- </button>- ) : (- <a- href={agentDetails.docsUrl}- target="_blank"- rel="noreferrer"- aria-label={t("settings.agents.agentDocs", {- agent: agentDetails.name,- })}- className="inline-flex items-center gap-1 rounded-full px-1.5 py-0.5 text-ui-11 font-medium text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"- >- {t("settings.agents.docs")}- <HugeiconsIcon icon={ArrowUpRight01Icon} className="size-3" />- </a>- )}- </div>- <p className="text-ui-11 leading-relaxed text-muted-foreground">- {t("settings.apiKeys.codingAgentsHint")}- </p>- <div className="@container">- <div className="grid grid-cols-1 items-start gap-3 @[34rem]:grid-cols-3">- <div className="min-w-0">- <Select- value={agent}- onValueChange={(id) => {- agentPickedByUserRef.current = true;- clickedUnderGgufRef.current = isGguf;- setAgent(id);- setStoredAgent(id);+ {part === "chat" ? null : (+ <div ref={agentsRef} className="flex min-w-0 scroll-mt-6 flex-col gap-2.5 pt-2">+ <div className="flex items-center justify-between gap-3">+ {agentsOnly ? (+ <span />+ ) : (+ <h2 className="settings-heading flex items-center gap-2 text-base font-semibold font-heading">+ <HugeiconsIcon icon={BotIcon} strokeWidth={1.75} className="size-[calc(18px*var(--ui-space-scale,1))] shrink-0 text-muted-foreground" />+ {t("settings.tabs.agents")}+ </h2>+ )}+ {/* Agents is an owner-only tab, so others get the docs. The tab reads this pref on mount. */}+ {isOwner ? (+ <button+ type="button"+ onClick={() => {+ setAgentsTabAgent(agent);+ if (agentsOnly) useSettingsDialogStore.getState().openDialog("agents");+ else useSettingsDialogStore.getState().setActiveTab("agents");}}+ className="inline-flex items-center gap-1 rounded-full px-1.5 py-0.5 text-ui-11 font-medium text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring">- <SelectTrigger- aria-label={t("settings.agents.agent")}- className="w-full rounded-full"- >- <SelectValue>- <span className="flex min-w-0 items-center gap-2">- <AgentIcon {...agentDetails} />- <span className="truncate">{agentDetails.name}</span>- </span>- </SelectValue>- </SelectTrigger>- {/* Seven 36px rows, as on the Agents tab; the rest scroll. */}- <SelectContent- align="start"- className="max-h-[min(var(--radix-select-content-available-height),calc(7*2.25rem+0.5rem))] [&_[data-slot=select-scroll-down-button]]:hidden [&_[data-slot=select-scroll-up-button]]:hidden"+ {t("settings.apiKeys.openAgentsTab")}+ <HugeiconsIcon icon={ChevronRightStandardIcon} className="size-3" />+ </button>+ ) : (+ <a+ href={agentDetails.docsUrl}+ target="_blank"+ rel="noreferrer"+ aria-label={t("settings.agents.agentDocs", {+ agent: agentDetails.name,+ })}+ className="inline-flex items-center gap-1 rounded-full px-1.5 py-0.5 text-ui-11 font-medium text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"+ >+ {t("settings.agents.docs")}+ <HugeiconsIcon icon={ArrowUpRight01Icon} className="size-3" />+ </a>+ )}+ </div>+ <p className="text-ui-11 leading-relaxed text-muted-foreground">+ {t("settings.apiKeys.codingAgentsHint")}+ </p>+ <div className="@container">+ <div className="grid grid-cols-1 items-start gap-3 @[34rem]:grid-cols-3">+ <div className="min-w-0">+ <Select+ value={agent}+ onValueChange={(id) => {+ agentPickedByUserRef.current = true;+ clickedUnderGgufRef.current = isGguf;+ setAgent(id);+ setStoredAgent(id);+ }}>- {availableAgents.map((id) => {- const details = detailsFor(id);- return (- <SelectItem key={id} value={id}>- <span className="flex min-w-0 items-center gap-2">- <AgentIcon {...details} />- <span className="truncate">{details.name}</span>- {detectedAgents.includes(id) ? (- <span className="shrink-0 rounded-full bg-control-accent/10 px-2 py-1 text-ui-10 leading-none font-semibold text-control-accent">- {t("settings.agents.quickstart.installed")}- </span>- ) : null}- </span>- </SelectItem>- );- })}- </SelectContent>- </Select>+ <SelectTrigger+ aria-label={t("settings.agents.agent")}+ className="w-full rounded-full"+ >+ <SelectValue>+ <span className="flex min-w-0 items-center gap-2">+ <AgentIcon {...agentDetails} />+ <span className="truncate">{agentDetails.name}</span>+ </span>+ </SelectValue>+ </SelectTrigger>+ <SelectContent+ align="start"+ className="max-h-[min(var(--radix-select-content-available-height),calc(7*2.25rem+0.5rem))] [&_[data-slot=select-scroll-down-button]]:hidden [&_[data-slot=select-scroll-up-button]]:hidden"+ >+ {availableAgents.map((id) => {+ const details = detailsFor(id);+ return (+ <SelectItem key={id} value={id}>+ <span className="flex min-w-0 items-center gap-2">+ <AgentIcon {...details} />+ <span className="truncate">{details.name}</span>+ {detectedAgents.includes(id) ? (+ <span className="shrink-0 rounded-full bg-control-accent/10 px-2 py-1 text-ui-10 leading-none font-semibold text-control-accent">+ {t("settings.agents.quickstart.installed")}+ </span>+ ) : null}+ </span>+ </SelectItem>+ );+ })}+ </SelectContent>+ </Select>+ </div></div></div>+ <div className="relative min-w-0">+ <code+ className="block min-w-0 whitespace-pre-wrap break-all rounded-3xl border border-border bg-background/70 py-2.5 pr-10 pl-4 font-mono text-ui-11 leading-relaxed text-foreground dark:border-transparent dark:bg-[rgb(255_255_255_/_calc(0.05*var(--contrast-wash-gain,1)))]"+ data-reload-snapshot-sensitive={apiKey ? "" : undefined}+ >+ {agentCommand}+ </code>+ <button+ type="button"+ onClick={handleCopyAgent}+ className="absolute top-1.5 right-2 flex size-6 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"+ aria-label={t("settings.apiKeys.copySnippet")}+ >+ <HugeiconsIcon+ icon={copiedAgent ? Tick02Icon : Copy01Icon}+ className={cn("size-3.5", copiedAgent && "text-control-accent")}+ />+ </button>+ </div>+ {agent === "vscode" && (+ <p className="text-ui-11 leading-relaxed text-muted-foreground">+ {t("settings.agents.vscodeNote")}+ </p>+ )}+ {agentsExtra ? <div ref={mcpRef}>{agentsExtra}</div> : null}</div>- <div className="relative min-w-0">- <code- className="block min-w-0 whitespace-pre-wrap break-all rounded-3xl border border-border bg-background/70 py-2.5 pr-10 pl-4 font-mono text-ui-11 leading-relaxed text-foreground dark:border-transparent dark:bg-[rgb(255_255_255_/_calc(0.05*var(--contrast-wash-gain,1)))]"- data-reload-snapshot-sensitive={apiKey ? "" : undefined}- >- {agentCommand}- </code>- <button- type="button"- onClick={handleCopyAgent}- className="absolute top-1.5 right-2 flex size-6 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"- aria-label={t("settings.apiKeys.copySnippet")}- >- <HugeiconsIcon- icon={copiedAgent ? Tick02Icon : Copy01Icon}- className={cn("size-3.5", copiedAgent && "text-control-accent")}- />- </button>- </div>- {agent === "vscode" && (- <p className="text-ui-11 leading-relaxed text-muted-foreground">- {t("settings.agents.vscodeNote")}- </p>- )}- {agentsExtra ? <div ref={mcpRef}>{agentsExtra}</div> : null}- </div>+ )}</section>);}diff --git a/studio/frontend/src/features/settings/settings-dialog.tsx b/studio/frontend/src/features/settings/settings-dialog.tsxindex 89e9db75843..29a1154da4e 100644--- a/studio/frontend/src/features/settings/settings-dialog.tsx+++ b/studio/frontend/src/features/settings/settings-dialog.tsx@@ -1,6 +1,7 @@// SPDX-License-Identifier: AGPL-3.0-only// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0+import { BrushCleaningIcon } from "@/lib/brush-cleaning-icon";import { useIsAccountOwner } from "@/features/auth";import { resolveSettingsTab, settingsTabVisible } from "./settings-tab-visibility";import { Button } from "@/components/ui/button";@@ -32,7 +33,6 @@ import {HelpCircleIcon,HomeWifiIcon,LibrariesIcon,- PaintBrush02Icon,Search01Icon,Settings02Icon,UserCircleIcon,@@ -196,7 +196,7 @@ const TABS: TabDef[] = [{id: "appearance",labelKey: "settings.tabs.appearance",- icon: PaintBrush02Icon,+ icon: BrushCleaningIcon,},{id: "resources",diff --git a/studio/frontend/src/features/settings/tabs/api-keys-tab.tsx b/studio/frontend/src/features/settings/tabs/api-keys-tab.tsxindex cd1e011ec00..41a00fa7104 100644--- a/studio/frontend/src/features/settings/tabs/api-keys-tab.tsx+++ b/studio/frontend/src/features/settings/tabs/api-keys-tab.tsx@@ -33,19 +33,17 @@ import {ApiKeyTableHeader,TOKEN_TABLE,} from "../components/api-key-row";-import { AudioApiExamples } from "../components/audio-api-examples";-import { MediaApiExamples } from "../components/media-api-examples";import { CreateKeyForm } from "../components/create-key-form";-import { DecisionApiSection } from "../components/decision-api-section";import { KeyRevealCard } from "../components/key-reveal-card";-import { ApiJumpLinks } from "../components/api-jump-links";import { KeylessApiAccessLink } from "../components/keyless-api-access-link";import { McpAccessSection } from "../components/mcp-access-section";import { ModelAliasesSection } from "../components/model-aliases-section";import { ModelAutoSwitchSection } from "../components/model-auto-switch-section";import { ModelMemorySection } from "../components/model-memory-section";import { MonitorLink } from "../components/monitor-link";-import { UsageExamples, useApiTunnelPref } from "../components/usage-examples";+import { SettingsSection } from "../components/settings-section";+import { ApiExamplesPanel } from "../components/api-example-tabs";+import { useApiTunnelPref } from "../components/usage-examples";import { usePublishAccessUrls } from "../hooks/use-publish-access-urls";function expiryDays(key: ApiKey): number | null {@@ -192,8 +190,6 @@ export function ApiKeysTab() {</p></header>- <ApiJumpLinks />-<section className="flex min-w-0 flex-col gap-4"><h2 className="settings-heading text-base font-semibold font-heading">{t("settings.apiKeys.accessTokens")}@@ -279,20 +275,21 @@ export function ApiKeysTab() {</div></section>- <UsageExamples+ <ApiExamplesPanelapiKey={revealed}useTunnel={useTunnel}onUseTunnelChange={setUseTunnel}keylessScope={keyless.scope}keylessTools={keyless.tools}keylessExposure={keyless.exposure}- // Installation-wide, so owner-only routes.- agentsExtra={isOwner ? <McpAccessSection apiKey={revealed} /> : null}/>- {isOwner ? <KeylessApiAccessLink /> : null}-- <MonitorLink />+ {/* Installation-wide, so owner-only routes. */}+ <SettingsSection title="Access & monitoring">+ {isOwner ? <McpAccessSection apiKey={revealed} /> : null}+ {isOwner ? <KeylessApiAccessLink /> : null}+ <MonitorLink hideHeading={true} />+ </SettingsSection>{isOwner ? (<>@@ -304,22 +301,6 @@ export function ApiKeysTab() {</>) : null}- <MediaApiExamples- apiKey={revealed}- useTunnel={useTunnel}- keylessScope={keyless.scope}- keylessExposure={keyless.exposure}- />-- <AudioApiExamples- apiKey={revealed}- useTunnel={useTunnel}- keylessScope={keyless.scope}- keylessExposure={keyless.exposure}- />-- {isOwner ? <DecisionApiSection /> : null}-<Dialogopen={revokeTarget !== null}onOpenChange={(o) => !o && setRevokeTarget(null)}diff --git a/studio/frontend/src/i18n/locales/en.ts b/studio/frontend/src/i18n/locales/en.tsindex 8a4a7f2831c..723e5d97dd3 100644--- a/studio/frontend/src/i18n/locales/en.ts+++ b/studio/frontend/src/i18n/locales/en.ts@@ -3331,7 +3331,7 @@ export const en = {loadError: "Couldn't load Decision API settings.",sendsTo: "Requests are sent to {provider}.",connectionMissing: "This connection is gone or has no decision models. Pick another model.",- addConnection: "To use a hosted decision model, add TypeSafe, Liquid AI or OpenRouter in Connections.",+ addConnection: "To use a cloud hosted decision model, add TypeSafe, OpenRouter etc. in Connections.",openConnections: "Open Connections",},mcp: {diff --git a/studio/frontend/src/lib/brush-cleaning-icon.ts b/studio/frontend/src/lib/brush-cleaning-icon.tsnew file mode 100644index 00000000000..9c27fe8599d--- /dev/null+++ b/studio/frontend/src/lib/brush-cleaning-icon.ts@@ -0,0 +1,30 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++import type { IconSvgElement } from "@hugeicons/react";++// Hugeicons BrushCleaningIcon (MIT), added to core-free-icons after the 4.1 this pins.+export const BrushCleaningIcon: IconSvgElement = [+ [+ "path",+ {+ d: "M14.25 16L14.6279 19.0232C14.8255 20.6038 13.593 22 12 22C10.407 22 9.17452 20.6038 9.3721 19.0232L9.75 16C9.85134 15.1892 9.90202 14.7839 9.72689 14.4892C9.663 14.3816 9.57951 14.2871 9.48074 14.2103C9.21003 14 8.8015 14 7.98444 14H7.83046C6.10918 14 5.24854 14 4.68301 13.5052C4.61617 13.4467 4.55331 13.3838 4.49483 13.317C4 12.7515 4 11.8908 4 10.1695V10H20V10.1695C20 11.8908 20 12.7515 19.5052 13.317C19.4467 13.3838 19.3838 13.4467 19.317 13.5052C18.7515 14 17.8908 14 16.1695 14H16.0156C15.1985 14 14.79 14 14.5193 14.2103C14.4205 14.2871 14.337 14.3816 14.2731 14.4892C14.098 14.7839 14.1487 15.1892 14.25 16Z",+ stroke: "currentColor",+ strokeLinecap: "round",+ strokeLinejoin: "round",+ strokeWidth: "1.5",+ key: "0",+ },+ ],+ [+ "path",+ {+ d: "M4 10V5.51472C4 5.03662 4 4.79756 4.0272 4.59696C4.20846 3.25997 5.25997 2.20846 6.59696 2.0272C6.79756 2 7.03662 2 7.51472 2C7.58456 2 7.61949 2 7.65311 2.00227C7.87143 2.017 8.07889 2.10293 8.24368 2.24689C8.26906 2.26906 8.29376 2.29376 8.34315 2.34315L8.58579 2.58579C9.25245 3.25245 9.58579 3.58579 10 3.58579C10.4142 3.58579 10.7475 3.25245 11.4142 2.58579C11.7032 2.29676 11.8478 2.15224 12.0315 2.07612C12.2153 2 12.4197 2 12.8284 2H14C16.8284 2 18.2426 2 19.1213 2.87868C20 3.75736 20 5.17157 20 8V10",+ stroke: "currentColor",+ strokeLinecap: "round",+ strokeLinejoin: "round",+ strokeWidth: "1.5",+ key: "1",+ },+ ],+];diff --git a/studio/frontend/tests/api-page-titlebar-row.test.ts b/studio/frontend/tests/api-page-titlebar-row.test.tsnew file mode 100644index 00000000000..fcdcae20144--- /dev/null+++ b/studio/frontend/tests/api-page-titlebar-row.test.ts@@ -0,0 +1,31 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++import assert from "node:assert/strict";+import test from "node:test";++import { readSrc } from "./helpers/kit.ts";++test("the API page's model picker sits in the titlebar row, where Chat's does", () => {+ const page = readSrc("features/api-monitor/api-monitor-page.tsx");+ const root = readSrc("app/routes/__root.tsx");+ assert.match(+ root,+ /const isChatLike = isChatRoute \|\| isImagesRoute \|\| isVideoRoute \|\| isAudioRoute;/,+ );+ assert.match(root, /--studio-non-chat-content-top-inset/);+ assert.match(+ page,+ /!isMobileShell &&\s*"-mt-\[calc\(var\(--studio-non-chat-content-top-inset,var\(--studio-content-top-inset,0px\)\)-var\(--studio-content-top-inset,0px\)\)\]"/,+ );+ assert.match(page, /"pointer-events-none sticky top-0 z-40 flex/);+ assert.match(+ page,+ /data-tour="api-toolbar" className="pointer-events-auto flex/,+ );+ const chat = readSrc("features/chat/chat-page.tsx");+ assert.match(+ chat,+ /"pointer-events-none relative z-40 flex h-\[calc\(48px\*var\(--ui-space-scale,1\)\)\] shrink-0 items-start/,+ );+});diff --git a/studio/frontend/tests/api-rows-and-appearance-icon.test.ts b/studio/frontend/tests/api-rows-and-appearance-icon.test.tsnew file mode 100644index 00000000000..d261eb4625c--- /dev/null+++ b/studio/frontend/tests/api-rows-and-appearance-icon.test.ts@@ -0,0 +1,71 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++import assert from "node:assert/strict";+import test from "node:test";++import { readSrc } from "./helpers/kit.ts";++test("Appearance uses the brush-cleaning icon wherever it is listed", () => {+ for (const file of [+ "features/settings/settings-dialog.tsx",+ "features/settings/components/sidebar-menu-customizer.tsx",+ "components/app-sidebar.tsx",+ ]) {+ const src = readSrc(file);+ assert.match(+ src,+ /import \{ BrushCleaningIcon \} from "@\/lib\/brush-cleaning-icon";/,+ file,+ );+ assert.doesNotMatch(src, /PaintBrush02Icon/, file);+ }+ assert.match(+ readSrc("lib/brush-cleaning-icon.ts"),+ /export const BrushCleaningIcon: IconSvgElement/,+ );+});++test("served-model facts hug their content with one gap, icons sized from their text", () => {+ const page = readSrc("features/api-monitor/api-monitor-page.tsx");+ assert.match(+ page,+ /@3xl\/served:grid-cols-\[minmax\(0,max-content\)_auto_auto_auto_auto_1fr\][^"]*@3xl\/served:gap-x-10/,+ );+ assert.match(page, /@3xl\/served:grid-cols-subgrid @3xl\/served:gap-x-10/);+ assert.match(page, /className="size-\[1em\] shrink-0 text-muted-foreground"/);+ assert.match(+ page,+ /<Fact label="Total time, average per request" icon=\{Clock01Icon\}>/,+ );+ assert.doesNotMatch(page, /Timer01Icon/);+ assert.match(+ page,+ /fitContent=\{true\}[\s\S]{0,140}className="-mx-2 -my-1 h-6 font-sans text-ui-12 tabular-nums/,+ );+ const chip = readSrc("features/chat/components/context-usage-bar.tsx");+ assert.match(+ chip,+ /fitContent \? "flex items-center" : "grid shrink! items-center"/,+ );+ assert.match(chip, /fitContent \? "gap-1\.5" : "w-\(--full\) gap-2"/);+});++test("the served-models line points to Model memory while one model at a time", () => {+ const page = readSrc("features/api-monitor/api-monitor-page.tsx");+ assert.match(+ page,+ /if \(!known \|\| keepLoaded \|\| servedCount > 1\) return null;/,+ );+ assert.match(page, /Enable loading multiple models in\{" "\}/);+ assert.match(+ page,+ /openDialog\("resources", \{\s*scrollTarget: "resources-model-memory",\s*\}\)/,+ );+ assert.match(+ page,+ /isOwner \? \([\s\S]{0,700}\) : \(\s*"One model at a time"\s*\)/,+ );+ assert.match(page, /<MultiModelHint servedCount=\{0\} \/>/);+ assert.match(page, /<MultiModelHint servedCount=\{served\.length\} \/>/);+});diff --git a/studio/frontend/tests/api-settings-tab.test.ts b/studio/frontend/tests/api-settings-tab.test.tsindex 990f947fb06..26229857ad9 100644--- a/studio/frontend/tests/api-settings-tab.test.ts+++ b/studio/frontend/tests/api-settings-tab.test.ts@@ -35,25 +35,45 @@ test("the API tab still publishes a tunnel URL that comes up after it opens", ()});test("usage examples sit right under the keys, where a new key lands", () => {- const examples = TAB.indexOf("<UsageExamples");+ const examples = TAB.indexOf("<ApiExamplesPanel");assert.ok(examples > TAB.indexOf("<CreateKeyForm"));- assert.ok(examples < TAB.indexOf("<MonitorLink />"));+ assert.ok(examples < TAB.indexOf("<MonitorLink hideHeading={true} />"));assert.ok(examples < TAB.indexOf("<KeylessApiAccessLink"));});-test("jump links above the token form reach the tab's APIs from any page, which sit images first, then audio, then decisions", () => {- const links = readSrc("features/settings/components/api-jump-links.tsx");+test("MCP, keyless access and the monitor sit under one heading", () => {+ assert.match(+ TAB,+ /<SettingsSection title="Access & monitoring">\s*\{isOwner \? <McpAccessSection apiKey=\{revealed\} \/> : null\}\s*\{isOwner \? <KeylessApiAccessLink \/> : null\}\s*<MonitorLink hideHeading=\{true\} \/>\s*<\/SettingsSection>/,+ );+ const keyless = readSrc("features/settings/components/keyless-api-access-link.tsx");+ assert.match(keyless, /<SettingsRow\s+label="Keyless API access"/);+ assert.doesNotMatch(keyless, /SettingsSection/);+ const monitor = readSrc("features/settings/components/monitor-link.tsx");+ assert.match(monitor, /hideHeading=\{hideHeading\}/);+});++test("one tab row holds every example, with no jump links above it; Agents opens its own settings", () => {const examples = readSrc("features/settings/components/usage-examples.tsx");- for (const target of ["api-keys-media-api", "api-keys-audio-api", "api-keys-decision-api", "api-keys-agents", "api-keys-mcp"]) {- assert.match(links, new RegExp(`target: "${target}"`));+ const tabs = readSrc("features/settings/components/api-example-tabs.tsx");+ assert.match(TAB, /<ApiExamplesPanel/);+ for (const gone of ["<UsageExamples", "<MediaApiExamples", "<AudioApiExamples", "<DecisionApiSection"]) {+ assert.ok(!TAB.includes(gone), gone);+ }+ for (const card of [+ /<UsageExamples\s+part="chat"/,+ /<MediaApiExamples[^>]*showHeading=\{false\}/,+ /<AudioApiExamples[^>]*showHeading=\{false\}/,+ /<DecisionApiSection showHeading=\{false\} \/>/,+ ]) {+ assert.match(tabs, card);+ }+ assert.doesNotMatch(tabs, /<h2|<h3/);+ assert.match(tabs, /entry\.id === "agents"\s*\? useSettingsDialogStore\.getState\(\)\.openDialog\("agents"\)/);+ assert.match(tabs, /\.\.\.\(isOwner\s*\? \[[\s\S]*?id: "agents" as const/);+ for (const [target, tab] of [["api-keys-media-api", "media"], ["api-keys-audio-api", "audio"], ["api-keys-decision-api", "decision"]]) {+ assert.match(tabs, new RegExp(`"${target}": "${tab}"`));}- assert.match(links, /openDialog\("api-keys", \{ scrollTarget: link\.target \}\)/);- assert.match(examples, /scrollTarget !== "api-keys-agents" && scrollTarget !== "api-keys-mcp"/);- assert.match(examples, /consumeScrollTarget\(target\)/);- assert.match(examples, /<div ref=\{agentsRef\} className=/);- assert.match(examples, /<div ref=\{mcpRef\}>\{agentsExtra\}<\/div>/);- assert.match(examples, /if \(agentsOnly\) return;\s*if \(scrollTarget !== "api-keys-agents"/);- assert.doesNotMatch(examples, /getElementById/);for (const [file, target] of [["media-api-examples.tsx", "api-keys-media-api"],["audio-api-examples.tsx", "api-keys-audio-api"],@@ -61,29 +81,17 @@ test("jump links above the token form reach the tab's APIs from any page, which]) {assert.match(readSrc(`features/settings/components/${file}`), new RegExp(`if \\(!showHeading \\|\\| scrollTarget !== "${target}"`), file);}- assert.ok(TAB.indexOf("<ApiJumpLinks") > 0);- assert.ok(TAB.indexOf("<ApiJumpLinks") < TAB.indexOf("<CreateKeyForm"));+ assert.match(examples, /if \(agentsOnly \|\| part !== "all"\) return;/);+ assert.match(examples, /\{part === "chat" \? null : \(/);+ assert.ok(!TAB.includes("ApiJumpLinks"));assert.match(TAB, /<h2 className="settings-heading text-base font-semibold font-heading">\s*\{t\("settings\.apiKeys\.accessTokens"\)\}\s*<\/h2>\s*<AnimatePresence/);- assert.equal(TAB.split('t("settings.apiKeys.accessTokens")').length - 1, 1);const monitor = readSrc("features/api-monitor/api-monitor-page.tsx");- assert.doesNotMatch(monitor, /<ApiJumpLinks/);- for (const part of [- /<MediaApiExamples useTunnel=\{useTunnel\} showHeading=\{false\} \/>/,- /<AudioApiExamples useTunnel=\{useTunnel\} showHeading=\{false\} \/>/,- /<DecisionApiSection showHeading=\{false\} \/>/,- /<UsageExamples[^>]*agentsOnly=\{true\}/,- ]) {- assert.match(monitor, part);- }- assert.match(monitor, /\.\.\.\(isOwner\s*\? \[\{ id: "decision" as const/);- assert.doesNotMatch(monitor, /McpAccessSection|id: "mcp"/);- assert.match(monitor, /font-heading text-ui-15/);- assert.match(examples, /\{agentsOnly \? null : \(/);+ assert.doesNotMatch(monitor, /<ApiJumpLinks|<UsageExamples/);+ assert.match(monitor, /<ApiExampleTabNav kind=\{kind\} onChange=\{setKind\}/);+ assert.match(tabs, /font-heading text-ui-15/);for (const icon of ["MessageCircleIcon", "Image01Icon", "AiSpeechIcon", "TaskDone01Icon", "BotIcon"]) {- assert.match(monitor, new RegExp(`label: "[^"]+", icon: ${icon} \\}`));+ assert.match(tabs, new RegExp(`icon: ${icon}`));}- assert.ok(TAB.indexOf("<MediaApiExamples") < TAB.indexOf("<AudioApiExamples"));- assert.ok(TAB.indexOf("<AudioApiExamples") < TAB.indexOf("<DecisionApiSection"));const decision = readSrc("features/settings/components/decision-api-section.tsx");assert.match(decision,@@ -148,3 +156,10 @@ test("the keyless note shows beside a public address too, since LAN callers stay);assert.equal(lan.match(/\{keylessNote\}/g)?.length, 2);});++test("the no-model note sits above the Basic / With tools / Advanced sampling toggle", () => {+ const examples = readSrc("features/settings/components/usage-examples.tsx");+ const note = examples.indexOf('t("settings.apiKeys.usageNoModel")');+ assert.ok(note > 0);+ assert.ok(note < examples.indexOf('label={t("settings.apiKeys.exampleRequest")}'));+});diff --git a/studio/frontend/tests/context-usage-compact.test.ts b/studio/frontend/tests/context-usage-compact.test.tsindex fbcddaf5bbf..172021cd48c 100644--- a/studio/frontend/tests/context-usage-compact.test.ts+++ b/studio/frontend/tests/context-usage-compact.test.ts@@ -18,7 +18,7 @@ test("the bar hands every input to the state, batching flags included", () => {const bar = readSrc("features/chat/components/context-usage-bar.tsx");assert.match(bar,- /\(\{ className, compactUnknownAsIcon = false, pinOnClick = false, hoverClassName, padX = 2\.5, ringFirst = false, \.\.\.input \}\) => \{\s*const pin = useClickPin\(pinOnClick\);\s*const state = deriveContextUsageBar\(input\);/,+ /\(\{ className, compactUnknownAsIcon = false, pinOnClick = false, hoverClassName, padX = 2\.5, ringFirst = false, fitContent = false, \.\.\.input \}\) => \{\s*const pin = useClickPin\(pinOnClick\);\s*const state = deriveContextUsageBar\(input\);/,);});diff --git a/studio/frontend/tests/decision-api-section.test.ts b/studio/frontend/tests/decision-api-section.test.tsindex a74ebffd576..0cb7961c4c1 100644--- a/studio/frontend/tests/decision-api-section.test.ts+++ b/studio/frontend/tests/decision-api-section.test.ts@@ -20,7 +20,11 @@ const API = read("../src/features/settings/api/systemone.ts");const API_TAB = read("../src/features/settings/tabs/api-keys-tab.tsx");test("the API tab renders the section and search finds it", () => {- assert.match(API_TAB, /<DecisionApiSection \/>/);+ const tabs = read("../src/features/settings/components/api-example-tabs.tsx");+ assert.match(API_TAB, /<ApiExamplesPanel/);+ assert.match(tabs, /<DecisionApiSection showHeading=\{false\} \/>/);+ assert.match(tabs, /searchLabel: "settings\.apiKeys\.decisionApi\.title"/);+ assert.match(tabs, /data-settings-label=\{\s*entry\.searchLabel \? t\(entry\.searchLabel\) : undefined\s*\}/);assert.ok(SETTINGS_SEARCH_INDEX["api-keys"].includes("settings.apiKeys.decisionApi.title",@@ -32,11 +36,13 @@ test("the API tab renders the section and search finds it", () => {);});-test("only the owner sees it, below the chat usage examples", () => {+test("only the owner sees it, as a tab after the chat, media and audio examples", () => {+ const tabs = read("../src/features/settings/components/api-example-tabs.tsx");assert.match(- API_TAB,- /<UsageExamples[\s\S]*?\/>\s*(?:\{\/\*[^*]*\*\/\}\s*)?\{isOwner \? <DecisionApiSection \/> : null\}/,+ tabs,+ /id: "audio",[\s\S]*?\.\.\.\(isOwner\s*\? \[\s*\{\s*id: "decision" as const/,);+ assert.match(tabs, /if \(tab === "decision" && !isOwner\) return;/);assert.doesNotMatch(SECTION, /useIsAccountOwner/);});@@ -173,3 +179,11 @@ test("a failed first load still renders the section with its error", () => {/translate\("settings.apiKeys.decisionApi.loadError"\)/,);});++test("Open Connections works off the dialog too, where the API page shows this card", () => {+ assert.match(+ SECTION,+ /onClick=\{\(\) =>\s*useSettingsDialogStore\.getState\(\)\.openDialog\("connections"\)\s*\}/,+ );+ assert.doesNotMatch(SECTION, /setActiveTab\("connections"\)/);+});diff --git a/studio/frontend/tests/hub-run-play-icon.test.ts b/studio/frontend/tests/hub-run-play-icon.test.tsindex 9990e1453b5..98de2b550b4 100644--- a/studio/frontend/tests/hub-run-play-icon.test.ts+++ b/studio/frontend/tests/hub-run-play-icon.test.ts@@ -14,6 +14,6 @@ test("Model hub's Run uses the filled play glyph Library's play buttons use", ()assert.match(library, filled);assert.match(card,- /<PlayIcon strokeWidth=\{2\} className="\[&_path\]:fill-current" \/>\s*Run/,+ /<PlayIcon strokeWidth=\{2\} className="\[&_path\]:fill-current" \/>\s*<span className="hub-run-action-label">Run<\/span>/,);});diff --git a/studio/frontend/tests/mcp-access-section.test.ts b/studio/frontend/tests/mcp-access-section.test.tsindex 921d70b5caa..b74794beea1 100644--- a/studio/frontend/tests/mcp-access-section.test.ts+++ b/studio/frontend/tests/mcp-access-section.test.ts@@ -30,10 +30,10 @@ const TUNNEL_PREF = readSrc(const LOCALES = { ar, de, en, es, fr, he, hi, it, ja, ko, ptBR, ru, sv, zhCN };-test("only the owner sees it, under the Agents heading, and settings search finds it", () => {+test("only the owner sees it, in the access group, and settings search finds it", () => {assert.match(API_TAB,- /agentsExtra=\{isOwner \? <McpAccessSection apiKey=\{revealed\} \/> : null\}/,+ /\{isOwner \? <McpAccessSection apiKey=\{revealed\} \/> : null\}/,);assert.match(API_TAB,