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: safer saved run settings, Always load, and API tab tidy-up (#15338)
Michael Han56289644d394
diff --git a/studio/backend/routes/settings.py b/studio/backend/routes/settings.pyindex d8dcc672962..8aa1d248012 100644--- a/studio/backend/routes/settings.py+++ b/studio/backend/routes/settings.py@@ -44,6 +44,7 @@ from utils.account_context import (current_account,is_owner_context,reset_account,+ run_as,)from hub.utils.hf_tokens import (HfTokenArg,@@ -2534,6 +2535,31 @@ def _fallback_supplies_reasoning_flag(model_id: str, target_id: str) -> bool:return False+def _owner_fallback_answers(model_id: str, target_id: str) -> bool:+ """Whether a managed account's load for this model would fall through to the owner's row once its own+ entry empties out. That fallback takes the owner's row whole, so a save left at the defaults has to keep+ a row of its own or the account gets the owner's flags, context and layers back."""+ from utils.openai_auto_switch_settings import cached_repo_alias_keys, get_model_override++ if is_owner_context():+ return False+ candidates = [+ key+ for key in (_bare_model_id(model_id), _legacy_standalone_gguf_key(model_id))+ if key and key != target_id+ ]+ # The account's own broader row answers first; the same-account rules above cover it.+ if any(get_model_override(key) for key in candidates):+ return False++ def _owner_has_row() -> bool:+ return any(get_model_override(key) for key in (model_id, *candidates)) or bool(+ cached_repo_alias_keys(model_id)+ )++ return run_as(OWNER, _owner_has_row)++def _other_quants_remain(bare_id: str, removed_ids: list[str]) -> bool:"""Whether a quant of ``bare_id`` other than the ones being removed still has an entry. Such a quant has itsown settings and never reads the bare fallback, so this is not "is anyone inheriting" but "is this@@ -2781,6 +2807,11 @@ def update_openai_auto_switch_override(payload.llama_extra_args == []and not payload.fill_absent_fieldsand _fallback_supplies_extra_args(payload.model_id, target_id)+ ) or (+ # A managed account's explicit save shadows the owner's row, defaults included.+ not is_removal+ and not payload.fill_absent_fields+ and _owner_fallback_answers(payload.model_id, target_id))# Unsent defaults are still written when a broader entry would answer with the flag this row shadows._kept_reasoning_budget = _kept_tuning["reasoning_budget"]diff --git a/studio/backend/tests/test_account_chat_settings.py b/studio/backend/tests/test_account_chat_settings.pyindex bf2df97529d..cf4c21d5df6 100644--- a/studio/backend/tests/test_account_chat_settings.py+++ b/studio/backend/tests/test_account_chat_settings.py@@ -495,6 +495,39 @@ def test_managed_load_uses_its_own_override_then_the_owners(fresh_override_cacheassert run_as(BOB, resolve_override_for_load, "org/other") == (None, {})+def test_managed_default_save_shadows_the_owners_override(client, fresh_override_cache):+ from utils.openai_auto_switch_settings import resolve_override_for_load, set_model_override++ run_as(+ OWNER,+ set_model_override,+ "org/model:Q4_K_M",+ llama_extra_args = ["--no-warmup"],+ max_seq_length = 4096,+ gpu_layers = 10,+ )+ url = "/settings/openai-auto-switch/overrides"+ defaults = {"model_id": "org/model:Q4_K_M", "remove": False, "llama_extra_args": []}+ saved = client.put(url, json = defaults)+ assert saved.status_code == 200, saved.text+ assert saved.json()["overrides"] == {"org/model:Q4_K_M": {"llama_extra_args": []}}+ for load in (("org/model:Q4_K_M",), ("org/model", None, "Q4_K_M")):+ key, override = run_as(ALICE, resolve_override_for_load, *load)+ assert key == "org/model:Q4_K_M" and override == {"llama_extra_args": []}+ shown = client.get(url, params = {"model_id": "org/model", "gguf_variant": "Q4_K_M"}).json()+ assert shown["resolved"] == {"llama_extra_args": []}+ owner = run_as(OWNER, resolve_override_for_load, "org/model:Q4_K_M")[1]+ assert owner["llama_extra_args"] == ["--no-warmup"] and owner["max_seq_length"] == 4096+ assert owner["gpu_layers"] == 10+ assert client.put(url, json = {"model_id": "org/model:Q4_K_M", "remove": False}).json()[+ "overrides"+ ] == {"org/model:Q4_K_M": {"llama_extra_args": []}}++ forgot = client.put(url, json = {"model_id": "org/model:Q4_K_M", "remove": True})+ assert forgot.status_code == 200 and forgot.json()["overrides"] == {}+ assert run_as(ALICE, resolve_override_for_load, "org/model:Q4_K_M")[1] == owner++def test_pinned_models_are_per_account(client):empty = client.get("/settings/pinned-models")assert empty.status_code == 200 and empty.json() == {diff --git a/studio/frontend/src/components/app-sidebar.tsx b/studio/frontend/src/components/app-sidebar.tsxindex aaa0ca9f460..df2b08f7f5a 100644--- a/studio/frontend/src/components/app-sidebar.tsx+++ b/studio/frontend/src/components/app-sidebar.tsx@@ -148,8 +148,8 @@ import {LayerIcon,ApiIcon,Clock01Icon,- Copy01Icon,} from "@hugeicons/core-free-icons";+import { Copy01Icon } from "@/lib/copy-icon";import {AiSpeechIcon,MessageCircleIcon,diff --git a/studio/frontend/src/components/assistant-ui/audio-player.tsx b/studio/frontend/src/components/assistant-ui/audio-player.tsxindex 852c6eff250..ebdc58ffb7e 100644--- a/studio/frontend/src/components/assistant-ui/audio-player.tsx+++ b/studio/frontend/src/components/assistant-ui/audio-player.tsx@@ -6,7 +6,8 @@import { Button } from "@/components/ui/button";import { downloadUrl, isDownloadCancelled } from "@/lib/native-files";import { toast } from "@/lib/toast";-import { Download01Icon, PauseIcon } from "@hugeicons/core-free-icons";+import { Download01Icon } from "@hugeicons/core-free-icons";+import { PauseIcon } from "@/lib/media-control-icons";import { HugeiconsIcon } from "@hugeicons/react";import { PlayIcon } from "lucide-react";import { type FC, useRef, useState } from "react";diff --git a/studio/frontend/src/components/assistant-ui/chat-dictation-bar.tsx b/studio/frontend/src/components/assistant-ui/chat-dictation-bar.tsxindex afa8966a980..269f5b3b791 100644--- a/studio/frontend/src/components/assistant-ui/chat-dictation-bar.tsx+++ b/studio/frontend/src/components/assistant-ui/chat-dictation-bar.tsx@@ -10,7 +10,7 @@ import { useAui, useAuiState } from "@assistant-ui/react";import { ArrowUpIcon } from "lucide-react";import { type FC, useEffect, useRef, useState } from "react";import { TooltipIconButton } from "./tooltip-icon-button";-import { StopIcon } from "@hugeicons/core-free-icons";+import { StopIcon } from "@/lib/media-control-icons";import { HugeiconsIcon } from "@hugeicons/react";const BAR_COUNT = 84;diff --git a/studio/frontend/src/components/assistant-ui/image.tsx b/studio/frontend/src/components/assistant-ui/image.tsxindex 0277de7ae6f..c9226110a1d 100644--- a/studio/frontend/src/components/assistant-ui/image.tsx+++ b/studio/frontend/src/components/assistant-ui/image.tsx@@ -19,7 +19,8 @@ import type {ImageMessagePart,ImageMessagePartComponent,} from "@assistant-ui/react";-import { Copy01Icon, Download01Icon } from "@hugeicons/core-free-icons";+import { Download01Icon } from "@hugeicons/core-free-icons";+import { Copy01Icon } from "@/lib/copy-icon";import { HugeiconsIcon } from "@hugeicons/react";import { type VariantProps, cva } from "class-variance-authority";import { ImageIcon, ImageOffIcon, ShieldAlertIcon } from "lucide-react";diff --git a/studio/frontend/src/components/assistant-ui/link-menu-content.tsx b/studio/frontend/src/components/assistant-ui/link-menu-content.tsxindex 0190ed2f6c3..00a5bb0dca3 100644--- a/studio/frontend/src/components/assistant-ui/link-menu-content.tsx+++ b/studio/frontend/src/components/assistant-ui/link-menu-content.tsx@@ -30,7 +30,6 @@ import { toast } from "@/lib/toast";import {ArrowUpRight01Icon,BubbleChatAddIcon,- Copy01Icon,Download01Icon,File01Icon,FolderOpenIcon,@@ -38,6 +37,7 @@ import {Link01Icon,LinkSquare02Icon,} from "@hugeicons/core-free-icons";+import { Copy01Icon } from "@/lib/copy-icon";import { HugeiconsIcon, type IconSvgElement } from "@hugeicons/react";import { useNavigate } from "@tanstack/react-router";import { sandboxRoutePrefix } from "./sandbox-files";diff --git a/studio/frontend/src/components/assistant-ui/markdown-table.tsx b/studio/frontend/src/components/assistant-ui/markdown-table.tsxindex f7828423457..6173b40aa21 100644--- a/studio/frontend/src/components/assistant-ui/markdown-table.tsx+++ b/studio/frontend/src/components/assistant-ui/markdown-table.tsx@@ -10,10 +10,10 @@ import {import { useT } from "@/i18n";import {Cancel01Icon,- Copy01Icon,Download01Icon,ExpandIcon,} from "@hugeicons/core-free-icons";+import { Copy01Icon } from "@/lib/copy-icon";import { HugeiconsIcon } from "@hugeicons/react";import {type ComponentProps,diff --git a/studio/frontend/src/components/assistant-ui/markdown-text.tsx b/studio/frontend/src/components/assistant-ui/markdown-text.tsxindex a1c607ee5c1..8e2dce44905 100644--- a/studio/frontend/src/components/assistant-ui/markdown-text.tsx+++ b/studio/frontend/src/components/assistant-ui/markdown-text.tsx@@ -48,7 +48,8 @@ import {useAui,useAuiState,} from "@assistant-ui/react";-import { Copy01Icon, Download01Icon } from "@hugeicons/core-free-icons";+import { Download01Icon } from "@hugeicons/core-free-icons";+import { Copy01Icon } from "@/lib/copy-icon";import { HugeiconsIcon } from "@hugeicons/react";import { createMathPlugin } from "@streamdown/math";import {diff --git a/studio/frontend/src/components/assistant-ui/prompt-queue-list.tsx b/studio/frontend/src/components/assistant-ui/prompt-queue-list.tsxindex 87c53837eb3..537a0d65360 100644--- a/studio/frontend/src/components/assistant-ui/prompt-queue-list.tsx+++ b/studio/frontend/src/components/assistant-ui/prompt-queue-list.tsx@@ -8,11 +8,11 @@ import {ListEndIcon,} from "lucide-react";import {- Copy01Icon,Delete02Icon,Edit03Icon,MoreHorizontalIcon,} from "@hugeicons/core-free-icons";+import { Copy01Icon } from "@/lib/copy-icon";import { HugeiconsIcon } from "@hugeicons/react";import { Button } from "@/components/ui/button";import {@@ -300,7 +300,8 @@ export function PromptQueueList({</Button></div>) : (- <div className="flex min-h-11 items-center gap-1 sm:min-h-12">+ // Compact for a pointer; touch keeps 44px targets, so its rows stay taller.+ <div className="flex min-h-8 items-center gap-1 pointer-coarse:min-h-11"><TooltipIconButtontype="button"tooltip={t("promptQueue.dragTooltip")}@@ -309,7 +310,7 @@ export function PromptQueueList({total: items.length,})}aria-describedby={instructionsId}- className="h-8 w-4 shrink-0 touch-none cursor-grab text-muted-foreground/50 hover:bg-transparent hover:text-muted-foreground/50 active:cursor-grabbing pointer-coarse:h-11 pointer-coarse:w-8 dark:hover:bg-transparent"+ className="h-7 w-4 shrink-0 touch-none cursor-grab text-muted-foreground/50 hover:bg-transparent hover:text-muted-foreground/50 active:cursor-grabbing pointer-coarse:h-11 pointer-coarse:w-8 dark:hover:bg-transparent"disabled={!canMove}onPointerDown={(event) => onPointerDown(event, item.id)}onPointerMove={onPointerMove}@@ -359,7 +360,7 @@ export function PromptQueueList({tooltip={t("promptQueue.steerTooltip")}aria-label={t("promptQueue.steerLabel", { position })}disabled={!item.canEdit || !item.canRemove}- className="h-8 w-auto shrink-0 gap-1.5 px-2 font-normal text-muted-foreground hover:text-foreground pointer-coarse:h-11"+ className="h-7 w-auto shrink-0 gap-1.5 px-2 font-normal text-muted-foreground hover:text-foreground pointer-coarse:h-11"onClick={() => {setAnnouncement(t(@@ -378,7 +379,7 @@ export function PromptQueueList({tooltip={t("promptQueue.removeTooltip")}aria-label={t("promptQueue.removeLabel", { position })}disabled={!item.canRemove}- className="size-8 shrink-0 text-muted-foreground hover:text-destructive pointer-coarse:size-11"+ className="size-7 shrink-0 text-muted-foreground hover:text-destructive pointer-coarse:size-11"onClick={() => {if (onRemove(item.id))setAnnouncement(t("promptQueue.announceRemoved"));@@ -393,7 +394,7 @@ export function PromptQueueList({tooltip={t("promptQueue.moreTooltip")}data-queue-menuaria-label={t("promptQueue.moreLabel", { position })}- className="size-8 shrink-0 text-muted-foreground hover:text-foreground data-[state=open]:bg-accent data-[state=open]:text-foreground pointer-coarse:size-11"+ className="size-7 shrink-0 text-muted-foreground hover:text-foreground data-[state=open]:bg-accent data-[state=open]:text-foreground pointer-coarse:size-11"><HugeiconsIcon icon={MoreHorizontalIcon} className="size-4" /></TooltipIconButton>diff --git a/studio/frontend/src/components/assistant-ui/reasoning.tsx b/studio/frontend/src/components/assistant-ui/reasoning.tsxindex a6c60c06100..70d5886e2b1 100644--- a/studio/frontend/src/components/assistant-ui/reasoning.tsx+++ b/studio/frontend/src/components/assistant-ui/reasoning.tsx@@ -67,7 +67,7 @@ import {import { copyToClipboard } from "@/lib/copy-to-clipboard";import { type VariantProps, cva } from "class-variance-authority";import { Tick02Icon } from "@/lib/tick-icon";-import { Copy01Icon } from "@hugeicons/core-free-icons";+import { Copy01Icon } from "@/lib/copy-icon";import { HugeiconsIcon } from "@hugeicons/react";import { IconActionButton } from "./icon-action-button";import {diff --git a/studio/frontend/src/components/assistant-ui/thread.tsx b/studio/frontend/src/components/assistant-ui/thread.tsxindex 4618429df51..f5285f9b1f6 100644--- a/studio/frontend/src/components/assistant-ui/thread.tsx+++ b/studio/frontend/src/components/assistant-ui/thread.tsx@@ -420,7 +420,6 @@ import {AttachmentIcon,Bookmark02Icon,CodeIcon,- Copy01Icon,Delete02Icon,Download01Icon,Edit03Icon,@@ -439,9 +438,10 @@ import {SlidersHorizontalIcon,MoreHorizontalIcon,PlusSignIcon,- StopIcon,Cancel01Icon,} from "@hugeicons/core-free-icons";+import { Copy01Icon } from "@/lib/copy-icon";+import { StopIcon } from "@/lib/media-control-icons";import { HugeiconsIcon } from "@hugeicons/react";import { RefreshGlyph } from "@/lib/refresh-icon";import { useNavigate } from "@tanstack/react-router";diff --git a/studio/frontend/src/components/assistant-ui/tool-code-cell.tsx b/studio/frontend/src/components/assistant-ui/tool-code-cell.tsxindex 32b285055a5..45a1dc6b3a7 100644--- a/studio/frontend/src/components/assistant-ui/tool-code-cell.tsx+++ b/studio/frontend/src/components/assistant-ui/tool-code-cell.tsx@@ -9,7 +9,8 @@ import { MAX_HIGHLIGHT_CHARS, codeFence } from "@/lib/markdown-plugins";import { downloadFile, isDownloadCancelled } from "@/lib/native-files";import { Tick02Icon } from "@/lib/tick-icon";import { toast } from "@/lib/toast";-import { Copy01Icon, Download01Icon } from "@hugeicons/core-free-icons";+import { Download01Icon } from "@hugeicons/core-free-icons";+import { Copy01Icon } from "@/lib/copy-icon";import { HugeiconsIcon } from "@hugeicons/react";import { IconActionButton } from "./icon-action-button";import { useCallback, useEffect, useMemo, useRef, useState } from "react";diff --git a/studio/frontend/src/components/media-viewer.tsx b/studio/frontend/src/components/media-viewer.tsxindex f047b2170c7..e8dc1fd60c3 100644--- a/studio/frontend/src/components/media-viewer.tsx+++ b/studio/frontend/src/components/media-viewer.tsx@@ -6,13 +6,13 @@ import {ArrowRight02Icon,ArrowTurnBackwardIcon,Cancel01Icon,- Copy01Icon,Delete02Icon,Download01Icon,Folder01Icon,Image02Icon,MoreHorizontalIcon,} from "@hugeicons/core-free-icons";+import { Copy01Icon } from "@/lib/copy-icon";import { HugeiconsIcon, type IconSvgElement } from "@hugeicons/react";import { type KeyboardEventHandler, type ReactNode, useRef, useState } from "react";diff --git a/studio/frontend/src/components/ui/copyable-error-chip.tsx b/studio/frontend/src/components/ui/copyable-error-chip.tsxindex dcb51c621e6..cf2bce1a9cd 100644--- a/studio/frontend/src/components/ui/copyable-error-chip.tsx+++ b/studio/frontend/src/components/ui/copyable-error-chip.tsx@@ -11,7 +11,7 @@ import {import { copyToClipboard } from "@/lib/copy-to-clipboard";import { Tick02Icon } from "@/lib/tick-icon";import { cn } from "@/lib/utils";-import { Copy01Icon } from "@hugeicons/core-free-icons";+import { Copy01Icon } from "@/lib/copy-icon";import { HugeiconsIcon } from "@hugeicons/react";import { useEffect, useRef, useState } from "react";diff --git a/studio/frontend/src/features/api-monitor/api-monitor-page.tsx b/studio/frontend/src/features/api-monitor/api-monitor-page.tsxindex 92a3d20696c..5a4f9fd5fd8 100644--- a/studio/frontend/src/features/api-monitor/api-monitor-page.tsx+++ b/studio/frontend/src/features/api-monitor/api-monitor-page.tsx@@ -29,14 +29,25 @@ import {type ModelConfigHandoffRequest,createModelConfigHandoffRequestId,} from "@/features/model-picker";+import { useIsAccountOwner } from "@/features/auth";import {loadLanAccess,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 { 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 { 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 {@@ -44,12 +55,13 @@ import {ArrowDataTransferVerticalIcon,Cancel01Icon,CodeIcon,+ BotIcon,ComputerTerminal01Icon,- Copy01Icon,+ Image01Icon,+ TaskDone01Icon,Delete02Icon,FileSearchIcon,FlashIcon,- PauseIcon,PlusSignIcon,Refresh01Icon,RemoveCircleIcon,@@ -57,6 +69,8 @@ import {Settings02Icon,Timer01Icon,} from "@hugeicons/core-free-icons";+import { Copy01Icon } from "@/lib/copy-icon";+import { PauseIcon } from "@/lib/media-control-icons";import { ReloadIcon } from "@/lib/reload-icon";import { HugeiconsIcon, type IconSvgElement } from "@hugeicons/react";import {@@ -846,6 +860,8 @@ function RequestDetail({);}+type QuickStartKind = "chat" | "media" | "audio" | "decision" | "agents";+function QuickStart({baseUrl,model,@@ -854,6 +870,18 @@ 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 },+ ];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">@@ -869,22 +897,66 @@ function QuickStart({</h3><p className="text-sm text-muted-foreground">{model- ? "Send a request to the base URL and it appears here as it streams."- : "Load a model, then send a request to the base URL. It appears here as it streams."}+ ? "Send a request to the base URL to see it here."+ : "Load a model, then send a request to see it here."}</p></div>- <div className="w-full max-w-2xl text-left">- <ApiExampleBox- choices={choices}- code={buildApiExample({- baseUrl,- model: model ?? "MODEL_ID",- sampling: {},- language: choices.language,- os: choices.os,- })}- />- </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>+ {kind === "chat" ? (+ <div className="w-full max-w-2xl text-left">+ <ApiExampleBox+ choices={choices}+ code={buildApiExample({+ baseUrl,+ model: model ?? "MODEL_ID",+ sampling: {},+ language: choices.language,+ os: choices.os,+ })}+ />+ </div>+ ) : (+ <div className="w-full max-w-3xl text-left">+ {kind === "media" ? (+ <MediaApiExamples useTunnel={useTunnel} showHeading={false} />+ ) : kind === "audio" ? (+ <AudioApiExamples useTunnel={useTunnel} showHeading={false} />+ ) : kind === "decision" ? (+ <DecisionApiSection showHeading={false} />+ ) : (+ <UsageExamples+ useTunnel={useTunnel}+ onUseTunnelChange={setUseTunnel}+ agentsOnly={true}+ />+ )}+ </div>+ )}<Buttontype="button"variant="outline"@@ -1421,7 +1493,7 @@ export function ApiMonitorPage(): ReactElement {className="pointer-events-none absolute inset-x-0 top-full h-6 bg-gradient-to-b from-background to-transparent"/></div>- <main className="@container/page mx-auto flex w-full max-w-6xl 3xl:max-w-[calc(1440px*var(--ui-space-scale,1))] 4xl:max-w-[calc(1760px*var(--ui-space-scale,1))] flex-col gap-5 px-6 pb-10 pt-4 max-sm:px-4 max-sm:pt-2 sm:px-10">+ <main className="api-monitor-page @container/page mx-auto flex w-full max-w-6xl 3xl:max-w-[calc(1440px*var(--ui-space-scale,1))] 4xl:max-w-[calc(1760px*var(--ui-space-scale,1))] flex-col gap-5 px-6 pb-10 pt-4 max-sm:px-4 max-sm:pt-2 sm:px-10"><GuidedTour {...tour.tourProps} /><header className="flex items-start justify-between gap-4 @2xl/page:items-end"><div className="flex min-w-0 flex-col gap-1">diff --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 3a59c247d0f..2375d11a3a2 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@@ -11,7 +11,7 @@ import {fetchModelOverrides,putModelOverride,} from "@/features/model-picker/api/model-overrides";-import { deletePerModelConfigsForOverrideKeys } from "@/features/model-picker/model-config/per-model-config";+import { forgetPerModelConfigsForOverrideKeys } from "@/features/model-picker/model-config/saved-run-settings";import { Delete02Icon } from "@hugeicons/core-free-icons";import { HugeiconsIcon } from "@hugeicons/react";import {@@ -169,7 +169,7 @@ export function SavedModelSettingsPanel(): ReactElement {listedKeys: Object.keys(overrides ?? {}),removeRemote: (modelId, ggufVariant) =>putModelOverride(modelId, ggufVariant, null),- removeLocal: deletePerModelConfigsForOverrideKeys,+ removeLocal: forgetPerModelConfigsForOverrideKeys,reload: load,onError: (message) => {toast.error(message);diff --git a/studio/frontend/src/features/audio/components/ab-compare.tsx b/studio/frontend/src/features/audio/components/ab-compare.tsxindex f9a3cced5fc..5d4e81f7815 100644--- a/studio/frontend/src/features/audio/components/ab-compare.tsx+++ b/studio/frontend/src/features/audio/components/ab-compare.tsx@@ -4,7 +4,7 @@import { Button } from "@/components/ui/button";import { PillTabs } from "@/features/model-picker/components/model-selector/pill-tabs";import { cn } from "@/lib/utils";-import { PauseIcon } from "@hugeicons/core-free-icons";+import { PauseIcon } from "@/lib/media-control-icons";import { HugeiconsIcon } from "@hugeicons/react";import { type Ref, useCallback, useEffect, useRef, useState } from "react";import { fetchAudioBlob } from "../api";diff --git a/studio/frontend/src/features/audio/components/audio-source-input.tsx b/studio/frontend/src/features/audio/components/audio-source-input.tsxindex 6f6595ec524..05afe3c45fd 100644--- a/studio/frontend/src/features/audio/components/audio-source-input.tsx+++ b/studio/frontend/src/features/audio/components/audio-source-input.tsx@@ -14,8 +14,8 @@ import {Alert02Icon,Cancel01Icon,PlusSignIcon,- StopIcon,} from "@hugeicons/core-free-icons";+import { StopIcon } from "@/lib/media-control-icons";import { AiSpeechIcon } from "@/lib/hugeicons-derived";import { MicIcon } from "@/lib/mic-icon";import { HugeiconsIcon } from "@hugeicons/react";diff --git a/studio/frontend/src/features/audio/components/clip-card.tsx b/studio/frontend/src/features/audio/components/clip-card.tsxindex 4949ee29062..11184d7d99d 100644--- a/studio/frontend/src/features/audio/components/clip-card.tsx+++ b/studio/frontend/src/features/audio/components/clip-card.tsx@@ -1,7 +1,8 @@// 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 { Download01Icon, StopIcon } from "@hugeicons/core-free-icons";+import { Download01Icon } from "@hugeicons/core-free-icons";+import { StopIcon } from "@/lib/media-control-icons";import { HugeiconsIcon } from "@hugeicons/react";import type { ReactNode } from "react";import { Button } from "@/components/ui/button";diff --git a/studio/frontend/src/features/audio/components/stem-mixer.tsx b/studio/frontend/src/features/audio/components/stem-mixer.tsxindex 3fbb597bc7f..ef869664b8f 100644--- a/studio/frontend/src/features/audio/components/stem-mixer.tsx+++ b/studio/frontend/src/features/audio/components/stem-mixer.tsx@@ -17,10 +17,10 @@ import { cn } from "@/lib/utils";import {Download01Icon,HeadphonesIcon,- PauseIcon,VolumeHighIcon,VolumeOffIcon,} from "@hugeicons/core-free-icons";+import { PauseIcon } from "@/lib/media-control-icons";import { HugeiconsIcon } from "@hugeicons/react";import {type KeyboardEvent,diff --git a/studio/frontend/src/features/audio/components/voice-picker.tsx b/studio/frontend/src/features/audio/components/voice-picker.tsxindex 8cc5fe3b6e2..e1bd47b66e0 100644--- a/studio/frontend/src/features/audio/components/voice-picker.tsx+++ b/studio/frontend/src/features/audio/components/voice-picker.tsx@@ -13,9 +13,9 @@ import { cn } from "@/lib/utils";import {Delete02Icon,MoreHorizontalIcon,- PauseIcon,PencilEdit02Icon,} from "@hugeicons/core-free-icons";+import { PauseIcon } from "@/lib/media-control-icons";import { HugeiconsIcon } from "@hugeicons/react";import { BlobUrlCache } from "@/lib/blob-url-cache";import { useEffect, useRef, useState } from "react";diff --git a/studio/frontend/src/features/audio/components/waveform.tsx b/studio/frontend/src/features/audio/components/waveform.tsxindex c062866e476..5779bf6f383 100644--- a/studio/frontend/src/features/audio/components/waveform.tsx+++ b/studio/frontend/src/features/audio/components/waveform.tsx@@ -3,7 +3,7 @@import { Button } from "@/components/ui/button";import { cn } from "@/lib/utils";-import { PauseIcon } from "@hugeicons/core-free-icons";+import { PauseIcon } from "@/lib/media-control-icons";import { HugeiconsIcon } from "@hugeicons/react";import {type CSSProperties,diff --git a/studio/frontend/src/features/audio/pages/transcribe-page.tsx b/studio/frontend/src/features/audio/pages/transcribe-page.tsxindex c6b8dfbac4f..20873df59ae 100644--- a/studio/frontend/src/features/audio/pages/transcribe-page.tsx+++ b/studio/frontend/src/features/audio/pages/transcribe-page.tsx@@ -18,10 +18,10 @@ import {import { Switch } from "@/components/ui/switch";import { cn } from "@/lib/utils";import {- Copy01Icon,Download01Icon,- StopIcon,} from "@hugeicons/core-free-icons";+import { Copy01Icon } from "@/lib/copy-icon";+import { StopIcon } from "@/lib/media-control-icons";import { HugeiconsIcon } from "@hugeicons/react";import { type Ref, useEffect, useState } from "react";import type { AudioGalleryClip } from "../api";diff --git a/studio/frontend/src/features/audio/pages/tts-workspace.tsx b/studio/frontend/src/features/audio/pages/tts-workspace.tsxindex fad5b1d4630..e3758d82fdd 100644--- a/studio/frontend/src/features/audio/pages/tts-workspace.tsx+++ b/studio/frontend/src/features/audio/pages/tts-workspace.tsx@@ -25,12 +25,12 @@ import { PillTabs } from "@/features/model-picker/components/model-selector/pillimport { toast } from "@/lib/toast";import { cn } from "@/lib/utils";import {- Copy01Icon,DiceFaces03Icon,FloppyDiskIcon,SparklesIcon,- StopIcon,} from "@hugeicons/core-free-icons";+import { Copy01Icon } from "@/lib/copy-icon";+import { StopIcon } from "@/lib/media-control-icons";import { AiSpeechIcon } from "@/lib/hugeicons-derived";import { HugeiconsIcon } from "@hugeicons/react";import { addAudioClipToProject, type AudioGalleryClip } from "../api";diff --git a/studio/frontend/src/features/audio/transcript-gallery.tsx b/studio/frontend/src/features/audio/transcript-gallery.tsxindex fd4697c8467..2daef3058b2 100644--- a/studio/frontend/src/features/audio/transcript-gallery.tsx+++ b/studio/frontend/src/features/audio/transcript-gallery.tsx@@ -12,11 +12,11 @@ import {import { HugeiconsIcon } from "@hugeicons/react";import {Archive02Icon,- Copy01Icon,Delete02Icon,Download01Icon,MoreVerticalIcon,} from "@hugeicons/core-free-icons";+import { Copy01Icon } from "@/lib/copy-icon";import { Button } from "@/components/ui/button";import {DropdownMenu,diff --git a/studio/frontend/src/features/browser/browser-panel.tsx b/studio/frontend/src/features/browser/browser-panel.tsxindex 1f8788f51cc..6c34db762c5 100644--- a/studio/frontend/src/features/browser/browser-panel.tsx+++ b/studio/frontend/src/features/browser/browser-panel.tsx@@ -76,7 +76,6 @@ import {Cancel01Icon,Clock01Icon,ComputerTerminal01Icon,- Copy01Icon,Folder01Icon,Link01Icon,Download01Icon,@@ -92,6 +91,7 @@ import {ViewIcon,VolumeMute02Icon,} from "@hugeicons/core-free-icons";+import { Copy01Icon } from "@/lib/copy-icon";import { ReloadIcon } from "@/lib/reload-icon";import { HugeiconsIcon, type IconSvgElement } from "@hugeicons/react";import {diff --git a/studio/frontend/src/features/browser/downloads-button.tsx b/studio/frontend/src/features/browser/downloads-button.tsxindex 00ffa83510c..21f57dcd202 100644--- a/studio/frontend/src/features/browser/downloads-button.tsx+++ b/studio/frontend/src/features/browser/downloads-button.tsx@@ -18,13 +18,13 @@ import { cn } from "@/lib/utils";import {Alert02Icon,CheckmarkCircle02Icon,- Copy01Icon,Delete02Icon,Download01Icon,Folder01Icon,MoreHorizontalIcon,ArrowUpRight01Icon,} from "@hugeicons/core-free-icons";+import { Copy01Icon } from "@/lib/copy-icon";import { HugeiconsIcon } from "@hugeicons/react";import { useEffect, useRef, useState } from "react";import { type FinishedDownload, mountDownloadsButton, useDownloadActivity } from "./download-activity";diff --git a/studio/frontend/src/features/browser/link-context-menu.tsx b/studio/frontend/src/features/browser/link-context-menu.tsxindex 69f48e5d1b7..f1169b6ab73 100644--- a/studio/frontend/src/features/browser/link-context-menu.tsx+++ b/studio/frontend/src/features/browser/link-context-menu.tsx@@ -14,10 +14,10 @@ import { openExternalLink } from "@/lib/open-link";import { toast } from "@/lib/toast";import {ArrowUpRight01Icon,- Copy01Icon,LinkSquare02Icon,PlusSignIcon,} from "@hugeicons/core-free-icons";+import { Copy01Icon } from "@/lib/copy-icon";import { HugeiconsIcon, type IconSvgElement } from "@hugeicons/react";import type { ReactElement, ReactNode } from "react";import { useBrowserStore } from "./store";diff --git a/studio/frontend/src/features/browser/tab-menu.tsx b/studio/frontend/src/features/browser/tab-menu.tsxindex 4ed01412963..b4c7fb7fe14 100644--- a/studio/frontend/src/features/browser/tab-menu.tsx+++ b/studio/frontend/src/features/browser/tab-menu.tsx@@ -28,7 +28,6 @@ import {BubbleChatAddIcon,BubbleChatTemporaryIcon,Cancel01Icon,- Copy01Icon,Link01Icon,LinkSquare02Icon,PencilEdit02Icon,@@ -37,6 +36,7 @@ import {VolumeHighIcon,VolumeMute02Icon,} from "@hugeicons/core-free-icons";+import { Copy01Icon } from "@/lib/copy-icon";import { ReloadIcon } from "@/lib/reload-icon";import { HugeiconsIcon, type IconSvgElement } from "@hugeicons/react";import { useNavigate } from "@tanstack/react-router";diff --git a/studio/frontend/src/features/browser/video-file.tsx b/studio/frontend/src/features/browser/video-file.tsxindex 26d330bf541..c78a96a67aa 100644--- a/studio/frontend/src/features/browser/video-file.tsx+++ b/studio/frontend/src/features/browser/video-file.tsx@@ -19,10 +19,10 @@ import {ArrowExpand01Icon,ArrowShrink01Icon,MoreHorizontalIcon,- PauseIcon,VolumeHighIcon,VolumeMute02Icon,} from "@hugeicons/core-free-icons";+import { PauseIcon } from "@/lib/media-control-icons";import { HugeiconsIcon } from "@hugeicons/react";import { type KeyboardEvent, useEffect, useRef, useState } from "react";import { canCopyVideoFrame, copyVideoFrame, registerTabVideo } from "./video-registry";diff --git a/studio/frontend/src/features/chat/api/chat-adapter.ts b/studio/frontend/src/features/chat/api/chat-adapter.tsindex 18098f07411..6f47d8f422f 100644--- a/studio/frontend/src/features/chat/api/chat-adapter.ts+++ b/studio/frontend/src/features/chat/api/chat-adapter.ts@@ -303,6 +303,7 @@ import {retainedContextPin,replayMaxTokensCap,} from "../presets/preset-policy";+import { reconcileTensorSplit } from "@/hooks/gpu-tensor-split";import { ensureGpuDeviceCache } from "@/hooks/use-gpu-info";import { useExternalProvidersStore } from "../stores/external-providers-store";import { takeThreadCompactionRequest } from "../stores/compact-request-store";@@ -3670,6 +3671,12 @@ async function autoLoadSmallestModel(options?: AutoLoadOptions): Promise<{isDiffusion,): null;+ // Reconciled against the raw pick: a ratio only applies to the GPU set it was saved with.+ const effectiveTensorSplit = reconcileTensorSplit(+ config.tensorSplit,+ config.selectedGpuIds,+ effectiveGpuIds,+ );// Manual memory with Auto layers lets llama.cpp --fit size context; send 0 or the pin (GGUF).const fitMaxSeqLength = resolveFitMaxSeqLength(candidate.kind === "gguf",@@ -3785,12 +3792,12 @@ async function autoLoadSmallestModel(options?: AutoLoadOptions): Promise<{tensor_parallel: effectiveTensorParallel,disable_vision: effectiveDisableVision,n_parallel: config.nParallel ?? null,- // Split ratio is never remembered (tied to an exact GPU set), so llama.cpp's default applies....(candidate.kind === "gguf"? {gpu_memory_mode: effectiveGpuMemoryMode,gpu_layers: effectiveGpuLayers,n_cpu_moe: effectiveNCpuMoe,+ tensor_split: effectiveTensorSplit ?? undefined,gpu_ids: effectiveGpuIds ?? undefined,...(config.nBatch != null ? { n_batch: config.nBatch } : {}),...(config.nUbatch != null ? { n_ubatch: config.nUbatch } : {}),diff --git a/studio/frontend/src/features/chat/artifacts/artifact-card.tsx b/studio/frontend/src/features/chat/artifacts/artifact-card.tsxindex 6ba66347243..1db7765b16b 100644--- a/studio/frontend/src/features/chat/artifacts/artifact-card.tsx+++ b/studio/frontend/src/features/chat/artifacts/artifact-card.tsx@@ -27,12 +27,12 @@ import { toast } from "@/lib/toast";import { cn } from "@/lib/utils";import { useAuiState } from "@assistant-ui/react";import {- Copy01Icon,Download01Icon,InternetIcon,LinkSquare02Icon,SourceCodeIcon,} from "@hugeicons/core-free-icons";+import { Copy01Icon } from "@/lib/copy-icon";import { HugeiconsIcon } from "@hugeicons/react";import { useEffect, useMemo, useRef } from "react";import { useChatRuntimeStore } from "../stores/chat-runtime-store";diff --git a/studio/frontend/src/features/chat/components/chat-header-menu.tsx b/studio/frontend/src/features/chat/components/chat-header-menu.tsxindex 0767c9d0097..a3518df1f19 100644--- a/studio/frontend/src/features/chat/components/chat-header-menu.tsx+++ b/studio/frontend/src/features/chat/components/chat-header-menu.tsx@@ -32,7 +32,6 @@ import {BubbleChatTemporaryIcon,Cancel01Icon,CollapseIcon,- Copy01Icon,Delete02Icon,Download01Icon,Edit03Icon,@@ -47,6 +46,7 @@ import {ViewIcon,ViewOffSlashIcon,} from "@hugeicons/core-free-icons";+import { Copy01Icon } from "@/lib/copy-icon";import { HugeiconsIcon, type IconSvgElement } from "@hugeicons/react";import { ForkIcon } from "@/lib/fork-icon";import { type ReactNode, useSyncExternalStore } from "react";diff --git a/studio/frontend/src/features/chat/components/temporary-chat-save.tsx b/studio/frontend/src/features/chat/components/temporary-chat-save.tsxindex a4860473987..44b4ce567f4 100644--- a/studio/frontend/src/features/chat/components/temporary-chat-save.tsx+++ b/studio/frontend/src/features/chat/components/temporary-chat-save.tsx@@ -25,10 +25,10 @@ import { cn } from "@/lib/utils";import { useAui, useAuiState } from "@assistant-ui/react";import {Bookmark02Icon,- Copy01Icon,Delete02Icon,MoreHorizontalIcon,} from "@hugeicons/core-free-icons";+import { Copy01Icon } from "@/lib/copy-icon";import { HugeiconsIcon } from "@hugeicons/react";import { Tooltip as TooltipPrimitive } from "radix-ui";import { useEffect, useId, useState } from "react";diff --git a/studio/frontend/src/features/chat/hooks/use-chat-model-runtime.ts b/studio/frontend/src/features/chat/hooks/use-chat-model-runtime.tsindex 9f06117502d..30ded6c6d1e 100644--- a/studio/frontend/src/features/chat/hooks/use-chat-model-runtime.ts+++ b/studio/frontend/src/features/chat/hooks/use-chat-model-runtime.ts@@ -193,6 +193,7 @@ import {invalidateLlamaFlagCatalog,loadManagedLlamaFlags,} from "@/features/model-picker/api/llama-flags";+import { sanitizeStoredExtraArgs } from "@/features/model-picker/model-config/llama-extra-args";import { usePlatformStore } from "@/config/env";import {DEFAULT_ENGINE_LAUNCH_FIELDS,@@ -2147,7 +2148,31 @@ export function useChatModelRuntime() {pendingLoadConfig?.reasoningBudgetMessage ??stateBeforeUnload.reasoningBudgetMessage;// No fallback: undefined means unread, and the route keeps stored flags when omitted.- const loadLlamaExtraArgs = pendingLoadConfig?.llamaExtraArgs;+ let loadLlamaExtraArgs = pendingLoadConfig?.llamaExtraArgs;+ if (+ isGguf &&+ !targetIsDiffusion &&+ loadLlamaExtraArgs != null &&+ loadLlamaExtraArgs.length > 0+ ) {+ // Sanitized like auto-load: a flag managed since it was saved would 400 the load.+ try {+ const managed = await loadManagedLlamaFlags();+ const cleaned = sanitizeStoredExtraArgs(+ loadLlamaExtraArgs,+ managed?.managed ?? new Set<string>(),+ {+ maxBytes: managed?.maxBytes,+ windowsCommandBudget: managed?.windowsCommandBudget,+ },+ );+ if (cleaned.length !== loadLlamaExtraArgs.length) {+ loadLlamaExtraArgs = cleaned;+ }+ } catch {+ // A flag-catalogue outage must not stop the load.+ }+ }let loadNBatch =pendingLoadConfig?.nBatch ?? stateBeforeUnload.nBatch;let loadNUbatch =diff --git a/studio/frontend/src/features/chat/shared-composer.tsx b/studio/frontend/src/features/chat/shared-composer.tsxindex bd2282c7235..eef8b12f16f 100644--- a/studio/frontend/src/features/chat/shared-composer.tsx+++ b/studio/frontend/src/features/chat/shared-composer.tsx@@ -125,10 +125,10 @@ import {Scroll01Icon,MoreHorizontalIcon,PlusSignIcon,- StopIcon,SlidersHorizontalIcon,Cancel01Icon,} from "@hugeicons/core-free-icons";+import { StopIcon } from "@/lib/media-control-icons";import { useNavigate } from "@tanstack/react-router";import { useChatActive } from "./runtime-provider";import { HugeiconsIcon } from "@hugeicons/react";diff --git a/studio/frontend/src/features/hub/catalog/download-cancel-indicator.tsx b/studio/frontend/src/features/hub/catalog/download-cancel-indicator.tsxindex b6457980a95..9cef0d441ae 100644--- a/studio/frontend/src/features/hub/catalog/download-cancel-indicator.tsx+++ b/studio/frontend/src/features/hub/catalog/download-cancel-indicator.tsx@@ -1,7 +1,8 @@// 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 { Cancel01Icon, PauseIcon } from "@hugeicons/core-free-icons";+import { Cancel01Icon } from "@hugeicons/core-free-icons";+import { PauseIcon } from "@/lib/media-control-icons";import { HugeiconsIcon } from "@hugeicons/react";/** HTTP keeps the partial (pause); Xet starts over (cancel). */diff --git a/studio/frontend/src/features/hub/catalog/gguf-download-card.tsx b/studio/frontend/src/features/hub/catalog/gguf-download-card.tsxindex 992099d906e..63069fe43d0 100644--- a/studio/frontend/src/features/hub/catalog/gguf-download-card.tsx+++ b/studio/frontend/src/features/hub/catalog/gguf-download-card.tsx@@ -38,7 +38,6 @@ import { toast } from "@/lib/toast";import { cn } from "@/lib/utils";import {Refresh01Icon,- Copy01Icon,Delete02Icon,Download01Icon,Folder01Icon,@@ -48,6 +47,7 @@ import {PinIcon,PinOffIcon,} from "@hugeicons/core-free-icons";+import { Copy01Icon } from "@/lib/copy-icon";import { HugeiconsIcon } from "@hugeicons/react";import {type KeyboardEventHandler,diff --git a/studio/frontend/src/features/hub/catalog/model-inspector.tsx b/studio/frontend/src/features/hub/catalog/model-inspector.tsxindex 4c77673b8d9..afd467f9cfa 100644--- a/studio/frontend/src/features/hub/catalog/model-inspector.tsx+++ b/studio/frontend/src/features/hub/catalog/model-inspector.tsx@@ -26,7 +26,6 @@ import { cn, formatCompact } from "@/lib/utils";import {Calendar03Icon,CalendarAdd01Icon,- Copy01Icon,CpuIcon,CubeIcon,Database02Icon,@@ -40,6 +39,7 @@ import {PackageIcon,LinkSquare02Icon,} from "@hugeicons/core-free-icons";+import { Copy01Icon } from "@/lib/copy-icon";import { TextToSpeechIcon } from "@/lib/hugeicons-derived";import type { IconSvgElement } from "@hugeicons/react";import { HugeiconsIcon } from "@hugeicons/react";diff --git a/studio/frontend/src/features/hub/catalog/path-info-button.tsx b/studio/frontend/src/features/hub/catalog/path-info-button.tsxindex e29fad43db6..a24d28d5bde 100644--- a/studio/frontend/src/features/hub/catalog/path-info-button.tsx+++ b/studio/frontend/src/features/hub/catalog/path-info-button.tsx@@ -8,7 +8,7 @@ import {} from "@/components/ui/tooltip";import { Tick02Icon } from "@/lib/tick-icon";import { cn } from "@/lib/utils";-import { Copy01Icon } from "@hugeicons/core-free-icons";+import { Copy01Icon } from "@/lib/copy-icon";import { HugeiconsIcon } from "@hugeicons/react";import type { MouseEvent } from "react";import { useCopyFeedback } from "../hooks/use-copy-feedback";diff --git a/studio/frontend/src/features/images/prompt-enhance-panel.tsx b/studio/frontend/src/features/images/prompt-enhance-panel.tsxindex 8ee5c18d638..bb6249e9675 100644--- a/studio/frontend/src/features/images/prompt-enhance-panel.tsx+++ b/studio/frontend/src/features/images/prompt-enhance-panel.tsx@@ -2,7 +2,8 @@// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0import { ChevronDownStandardIcon } from "@/lib/chevron-icons";-import { Cancel01Icon, Copy01Icon, SparklesIcon, Download01Icon } from "@hugeicons/core-free-icons";+import { Cancel01Icon, SparklesIcon, Download01Icon } from "@hugeicons/core-free-icons";+import { Copy01Icon } from "@/lib/copy-icon";import { HugeiconsIcon } from "@hugeicons/react";import { useCallback, useEffect, useRef, useState } from "react";diff --git a/studio/frontend/src/features/library/chats/chats-items.tsx b/studio/frontend/src/features/library/chats/chats-items.tsxindex 91fb7d3c04f..79904510e4b 100644--- a/studio/frontend/src/features/library/chats/chats-items.tsx+++ b/studio/frontend/src/features/library/chats/chats-items.tsx@@ -1056,6 +1056,7 @@ export function ChatRow({locationColumn = showProject || showSection,fileColumns = false,times = {},+ showTile = true,}: {chat: SidebarItem;archived: boolean;@@ -1064,6 +1065,7 @@ export function ChatRow({locationColumn?: boolean;fileColumns?: boolean;times?: RowTimes;+ showTile?: boolean;}) {const t = useT();const locale = useLocale();@@ -1089,8 +1091,8 @@ export function ChatRow({visible={actions.selection.size > 0}className="absolute end-full top-1/2 me-3 flex -translate-y-1/2"/>- <div className="flex min-w-0 flex-1 items-center gap-4 py-2">- <ChatTile chat={chat} />+ <div className={cn("flex min-w-0 flex-1 items-center gap-4 py-2", !showTile && TILELESS_ROW_NAME)}>+ {showTile && <ChatTile chat={chat} />}<div className="flex min-w-0 flex-col"><span className="flex min-w-0 items-center gap-2"><button@@ -1151,12 +1153,14 @@ export function ChatCard({showProject,showSection,times = {},+ showTile = true,}: {chat: SidebarItem;archived: boolean;showProject: boolean;showSection: boolean;times?: RowTimes;+ showTile?: boolean;}) {const t = useT();const locale = useLocale();@@ -1176,9 +1180,9 @@ export function ChatCard({}className={cn(CARD, selected && "ring-2 ring-foreground")}>- <div className="flex items-center gap-2">- <ChatTile chat={chat} />- <ChatBadges chat={chat} marksOnly />+ <div className={cn("flex items-center gap-2", !showTile && TILELESS_ROW)}>+ {showTile && <ChatTile chat={chat} />}+ <ChatBadges chat={chat} marksOnly={showTile} /></div><ChatMenu chat={chat} archived={archived} variant="card" /><SelectBox chat={chat} visible={selecting} className="absolute bottom-5 end-4 flex" />@@ -1189,7 +1193,7 @@ export function ChatCard({if (selecting) actions.toggleSelected(chat.id, event.shiftKey);else actions.open(chat);}}- className={CARD_TITLE}+ className={cn(CARD_TITLE, !showTile && TILELESS_TITLE)}>{/* Buttons ignore line-clamp, so clamp an inner span. */}<span className="line-clamp-2">{chatTitle(chat, t)}</span>@@ -1217,6 +1221,11 @@ function CardFooter({ meta, date, className }: { meta?: ReactNode; date: string;);}+// Without a tile, the empty marks row collapses and the title clears the corner menu.+const TILELESS_ROW = "empty:hidden pe-8";+const TILELESS_TITLE = "pe-6";+const TILELESS_ROW_NAME = "min-h-13";+const CARD_TITLE ="block w-full rounded-md text-left font-medium text-ui-14 leading-snug text-foreground outline-none [overflow-wrap:anywhere] focus-visible:ring-2 focus-visible:ring-ring";@@ -1392,9 +1401,11 @@ function chatCount(count: number, t: ReturnType<typeof useT>): string {export function ProjectCard({project,stats,+ showTile = true,}: {project: ProjectRecord;stats?: ProjectStats;+ showTile?: boolean;}) {const t = useT();const locale = useLocale();@@ -1406,8 +1417,8 @@ export function ProjectCard({onClick={() => actions.viewProject(project.id)}className={CARD}>- <div className="flex items-center gap-2">- <CollectionTile icon={Folder02Icon} />+ <div className={cn("flex items-center gap-2", !showTile && TILELESS_ROW)}>+ {showTile && <CollectionTile icon={Folder02Icon} />}{actions.favoriteProjects.has(project.id) && <FavoriteMark />}{pinned && <PinMark />}</div>@@ -1418,7 +1429,7 @@ export function ProjectCard({event.stopPropagation();actions.viewProject(project.id);}}- className={CARD_TITLE}+ className={cn(CARD_TITLE, !showTile && TILELESS_TITLE)}><span className="line-clamp-2">{project.name}</span></button>@@ -1434,10 +1445,12 @@ export function ProjectRow({project,stats,layout = "own",+ showTile = true,}: {project: ProjectRecord;stats?: ProjectStats;layout?: CollectionRowLayout;+ showTile?: boolean;}) {const t = useT();const locale = useLocale();@@ -1456,8 +1469,8 @@ export function ProjectRow({ROW_INSET,)}>- <div className="flex min-w-0 flex-1 items-center gap-4 py-2">- <CollectionTile icon={Folder02Icon} />+ <div className={cn("flex min-w-0 flex-1 items-center gap-4 py-2", !showTile && TILELESS_ROW_NAME)}>+ {showTile && <CollectionTile icon={Folder02Icon} />}<div className="flex min-w-0 flex-col"><span className="flex min-w-0 items-center gap-2"><button@@ -1638,9 +1651,11 @@ function sectionCountLabel(export function SectionCard({section,stats,+ showTile = true,}: {section: SidebarCustomSection;stats?: SectionStats;+ showTile?: boolean;}) {const t = useT();const locale = useLocale();@@ -1651,8 +1666,8 @@ export function SectionCard({onClick={() => actions.viewSection(section.id)}className={CARD}>- <div className="flex items-center gap-2">- <CollectionTile icon={LayerIcon} />+ <div className={cn("flex items-center gap-2", !showTile && TILELESS_ROW)}>+ {showTile && <CollectionTile icon={LayerIcon} />}{actions.favoriteSections.has(section.id) && <FavoriteMark />}</div><SectionMenu section={section} variant="card" />@@ -1662,7 +1677,7 @@ export function SectionCard({event.stopPropagation();actions.viewSection(section.id);}}- className={CARD_TITLE}+ className={cn(CARD_TITLE, !showTile && TILELESS_TITLE)}><span className="line-clamp-2">{section.name}</span></button>@@ -1678,10 +1693,12 @@ export function SectionRow({section,stats,layout = "own",+ showTile = true,}: {section: SidebarCustomSection;stats?: SectionStats;layout?: CollectionRowLayout;+ showTile?: boolean;}) {const t = useT();const locale = useLocale();@@ -1695,8 +1712,8 @@ export function SectionRow({ROW_INSET,)}>- <div className="flex min-w-0 flex-1 items-center gap-4 py-2">- <CollectionTile icon={LayerIcon} />+ <div className={cn("flex min-w-0 flex-1 items-center gap-4 py-2", !showTile && TILELESS_ROW_NAME)}>+ {showTile && <CollectionTile icon={LayerIcon} />}<span className="flex min-w-0 items-center gap-2"><buttontype="button"diff --git a/studio/frontend/src/features/library/chats/chats-library.tsx b/studio/frontend/src/features/library/chats/chats-library.tsxindex 0e2cbecd42a..2bcfb8fe09f 100644--- a/studio/frontend/src/features/library/chats/chats-library.tsx+++ b/studio/frontend/src/features/library/chats/chats-library.tsx@@ -1051,6 +1051,7 @@ export function ChatsLibrary({showSection={showSection}locationColumn={locationColumn}times={{ bucket }}+ showTile={shownEntries !== null}/>) : (<ChatCard@@ -1060,6 +1061,8 @@ export function ChatsLibrary({showProject={showProject}showSection={showSection}times={{ bucket }}+ // Only All mixes chats with projects and sections; elsewhere the tab names the kind.+ showTile={shownEntries !== null}/>);const entryRow = (entry: NonNullable<typeof shownEntries>[number]) => {@@ -1177,7 +1180,7 @@ export function ChatsLibrary({<SectionListHeader date={sectionDateColumn} /><div className={cn("mt-1 flex flex-col", LIST_ROW_GAP)}>{visibleSections.map((entry) => (- <SectionRow key={entry.id} section={entry} stats={sectionStatsById.get(entry.id)} />+ <SectionRow key={entry.id} section={entry} stats={sectionStatsById.get(entry.id)} showTile={false} />))}</div></div>@@ -1194,7 +1197,7 @@ export function ChatsLibrary({{t("shell.sections.newSection")}</button>{visibleSections.map((entry) => (- <SectionCard key={entry.id} section={entry} stats={sectionStatsById.get(entry.id)} />+ <SectionCard key={entry.id} section={entry} stats={sectionStatsById.get(entry.id)} showTile={false} />))}</CardGrid>);@@ -1226,13 +1229,13 @@ export function ChatsLibrary({{view === "list" ? (<div className={cn("flex flex-col", LIST_ROW_GAP)}>{sectionProjects.map((project) => (- <ProjectRow key={project.id} project={project} stats={stats.get(project.id)} />+ <ProjectRow key={project.id} project={project} stats={stats.get(project.id)} showTile={false} />))}</div>) : (<CardGrid equalRows>{sectionProjects.map((project) => (- <ProjectCard key={project.id} project={project} stats={stats.get(project.id)} />+ <ProjectCard key={project.id} project={project} stats={stats.get(project.id)} showTile={false} />))}</CardGrid>)}@@ -1272,7 +1275,7 @@ export function ChatsLibrary({<ProjectListHeader date={projectDateColumn} /><div className={cn("mt-1 flex flex-col", LIST_ROW_GAP)}>{visibleProjects.map((project) => (- <ProjectRow key={project.id} project={project} stats={stats.get(project.id)} />+ <ProjectRow key={project.id} project={project} stats={stats.get(project.id)} showTile={false} />))}</div></div>@@ -1291,7 +1294,7 @@ export function ChatsLibrary({</button>)}{visibleProjects.map((project) => (- <ProjectCard key={project.id} project={project} stats={stats.get(project.id)} />+ <ProjectCard key={project.id} project={project} stats={stats.get(project.id)} showTile={false} />))}</CardGrid>);diff --git a/studio/frontend/src/features/library/components/library-cards.tsx b/studio/frontend/src/features/library/components/library-cards.tsxindex c01c3a6e64c..608f9fbe180 100644--- a/studio/frontend/src/features/library/components/library-cards.tsx+++ b/studio/frontend/src/features/library/components/library-cards.tsx@@ -4,7 +4,8 @@import { Checkbox } from "@/components/ui/checkbox";import { useLocale, useT } from "@/i18n";import { cn } from "@/lib/utils";-import { Folder01Icon, PauseIcon } from "@hugeicons/core-free-icons";+import { Folder01Icon } from "@hugeicons/core-free-icons";+import { PauseIcon } from "@/lib/media-control-icons";import { HugeiconsIcon } from "@hugeicons/react";import { type ReactNode, type RefObject, useContext, useRef, useState } from "react";import type { LibraryFolder, LibraryItem } from "../api";diff --git a/studio/frontend/src/features/model-picker/api/model-overrides.ts b/studio/frontend/src/features/model-picker/api/model-overrides.tsindex ef4fd16f6cb..9ae3bfc3d66 100644--- a/studio/frontend/src/features/model-picker/api/model-overrides.ts+++ b/studio/frontend/src/features/model-picker/api/model-overrides.ts@@ -16,9 +16,9 @@ import {DEFAULT_PER_MODEL_CONFIG,normalizeMlxKvQuant,type PerModelConfig,- deletePerModelConfigsForOverrideKeys,normalizePerModelConfig,} from "../model-config/per-model-config";+import { forgetPerModelConfigsForOverrideKeys } from "../model-config/saved-run-settings";const OVERRIDES_URL = "/api/settings/openai-auto-switch/overrides";@@ -567,7 +567,10 @@ async function sendModelOverride(? // biome-ignore lint/style/useNamingConvention: API schema{ llama_extra_args: [] }: {}),- ...toApiOverride(config),+ // {} would leave the engine group and MLX offloads; the defaults omit llama_extra_args.+ ...toApiOverride(+ config ?? (options?.keepLaunchFlags ? DEFAULT_PER_MODEL_CONFIG : null),+ ),// Reset markers remove legacy passthrough flags; fill-only migration must never delete....(options?.resetReasoningBudget && config?.reasoningBudget === -1? {@@ -612,7 +615,7 @@ export function syncModelOverride(): void {void putModelOverride(modelId, ggufVariant, config, options).then(({ removedKeys }) => {- if (!deletePerModelConfigsForOverrideKeys(removedKeys)) {+ if (!forgetPerModelConfigsForOverrideKeys(removedKeys)) {console.warn("Forgot model settings on the server, but this browser kept its own copy.",);diff --git a/studio/frontend/src/features/model-picker/components/model-config-page.tsx b/studio/frontend/src/features/model-picker/components/model-config-page.tsxindex 38d2128e96c..a31df144ec2 100644--- a/studio/frontend/src/features/model-picker/components/model-config-page.tsx+++ b/studio/frontend/src/features/model-picker/components/model-config-page.tsx@@ -9,14 +9,19 @@ import {adoptRememberedRunSettings,deleteSavedRunSettings,findSavedRunSettings,- hasLegacyRunSettings,+ getPinnedRunSettings,+ getRunSettingsLoadedOnce,+ isRunSettingsLimitReached,newRunSettingsName,normalizeSavedRunSettingsName,+ noteRunSettingsLoadedOnce,quantsSelectingRunSettings,- renameLegacyRunSettings,renameSavedRunSettings,+ SAVED_RUN_SETTINGS_PER_MODEL_MAX,saveRunSettings,+ setPinnedRunSettings,setSelectedRunSettings,+ usePinnedRunSettings,useSavedRunSettings,useSelectedRunSettings,} from "../model-config/saved-run-settings";@@ -33,6 +38,7 @@ import {import { useLlamaCppBackend } from "@/hooks/use-llama-backend";import { useSliderDraft } from "@/hooks/use-slider-draft";import { Button } from "@/components/ui/button";+import { Checkbox } from "@/components/ui/checkbox";import { InfoHint } from "@/components/ui/info-hint";import {Select,@@ -47,6 +53,7 @@ import { usePlatformStore } from "@/config/env";import {GPU_LAYERS_AUTO,fetchGgufStagedMetadata,+ normalizeSpeculativeType,readPersistedGpuMemoryMode,readPersistedSpeculativeType,resolveStagedDiffusionClassification,@@ -177,6 +184,7 @@ import {retainModelConfigDraft,setExtraArgsEditForDraft,setExtraArgsEditLoadableForDraft,+ setModelConfigDraftPickedSet,setModelConfigDraftRemember,setModelConfigDraftSavedRemember,subscribeModelConfigDraft,@@ -2485,6 +2493,7 @@ export function ModelConfigPage({focusField,}: ModelConfigPageProps) {const saveStatusId = useId();+ const alwaysLoadId = useId();const platformDeviceType = usePlatformStore((s) => s.deviceType);// Wording only ("Unified" vs "Shared"); not the capacity signal, see hasUnifiedMemory.const isAppleUnifiedMemory = usePlatformStore((s) => s.appleSilicon);@@ -2998,13 +3007,16 @@ export function ModelConfigPage({if (perModelConfigStorageChanged(storedAtStart, storedConfig)) {return;}- setExtraArgsLoadable(hydratedIsLoadable);- replaceModelConfigDraft(draftKey, serverConfig, {- remember: true,- savedRemember: true,- });- if (hasNonDefaultAdvanced(serverConfig)) {- setAutoOpenAdvanced(true);+ // Pinned, the row is the pinned set; a model loaded once with another must keep showing it.+ if (!(loadedConfig && getPinnedRunSettings(configId, target.ggufVariant) !== null)) {+ setExtraArgsLoadable(hydratedIsLoadable);+ replaceModelConfigDraft(draftKey, serverConfig, {+ remember: true,+ savedRemember: true,+ });+ if (hasNonDefaultAdvanced(serverConfig)) {+ setAutoOpenAdvanced(true);+ }}// Unconditionally: savePerModelConfig clears by deleting, so a default merge must still travel.const rememberedConfig = fromApiOverride(@@ -3458,7 +3470,6 @@ export function ModelConfigPage({unifiedPoolReportedAsGpuMemory: isAppleUnifiedMemory,});- const rememberChanged = remember !== savedRemember;const storedRecord = useStoredPerModelConfig(configId, target.ggufVariant);const matchesStored =storedRecord.remembered &&@@ -3469,30 +3480,84 @@ export function ModelConfigPage({const modelName = modelDisplayName(configId);const savedSets = useSavedRunSettings(configId);const persistedSet = useSelectedRunSettings(configId, target.ggufVariant);- // undefined: follow what is stored.- const [pickedSet, setPickedSet] = useState<string | null | undefined>(undefined);+ // undefined: follow what is stored. Shared, or the other editor saves this set's values elsewhere.+ const pickedSet = draftSnapshot?.pickedSet;+ const setPickedSet = useCallback(+ (next: string | null | undefined) => setModelConfigDraftPickedSet(draftKey, next),+ [draftKey],+ );const [naming, setNaming] = useState<RunSettingsNaming | null>(null);+ const [pendingDelete, setPendingDelete] = useState<string | null>(null);useEffect(() => {if (storedRecord.remembered && persistedSet === undefined) {adoptRememberedRunSettings(configId, target.ggufVariant, storedRecord.config, modelName);}}, [storedRecord, persistedSet, configId, target.ggufVariant, modelName]);+ const forSetStore = (next: PerModelConfig) =>+ normalizePerModelConfig(storedSpeculativeAuto(next, targetIsMlx));+ const persistedEntry =+ typeof persistedSet === "string" ? findSavedRunSettings(savedSets, persistedSet) : null;+ // Its record is gone, so the set no longer loads and Save would write defaults over it.+ const selectionStale =+ persistedEntry !== null &&+ !extraArgsHydrating &&+ !storedRecord.remembered &&+ !savedRemember &&+ !isDefaultConfig(forSetStore(persistedEntry.config));useEffect(() => {- if (hasLegacyRunSettings(savedSets, modelName)) {- renameLegacyRunSettings(configId, modelName);+ if (selectionStale) {+ setSelectedRunSettings(configId, target.ggufVariant, null);+ setPinnedRunSettings(configId, target.ggufVariant, null);}- }, [savedSets, configId, modelName]);- const wantedSet = pickedSet !== undefined ? pickedSet : (persistedSet ?? null);+ }, [selectionStale, configId, target.ggufVariant]);+ const pinnedName = usePinnedRunSettings(configId, target.ggufVariant);+ const pinnedEntry =+ pinnedName === null ? null : findSavedRunSettings(savedSets, pinnedName);+ const pinnedSet = pinnedEntry?.name ?? null;+ // The runtime resolves auto fields, so match what the one-time load sent, not only saved sets.+ const loadedOnceNamed = (loaded: PerModelConfig): string | null | undefined => {+ const noted = getRunSettingsLoadedOnce(configId, target.ggufVariant);+ if (!noted || !perModelConfigsEqual(forSetStore(loaded), forSetStore(noted.sent))) {+ return undefined;+ }+ return noted.name === null || findSavedRunSettings(savedSets, noted.name)+ ? noted.name+ : undefined;+ };+ const inferOnce =+ pinnedEntry !== null && pickedSet === undefined && loadedConfig != null && atBaseline;+ // Record first, null (Default) included: a set holding the pin's values still names itself.+ const notedOnce = inferOnce ? loadedOnceNamed(loadedConfig) : undefined;+ const loadedOnce =+ notedOnce !== undefined+ ? notedOnce+ : inferOnce &&+ !perModelConfigsEqual(forSetStore(loadedConfig), forSetStore(pinnedEntry.config))+ ? (savedSets.find((entry) =>+ perModelConfigsEqual(forSetStore(loadedConfig), forSetStore(entry.config)),+ )?.name ?? (isDefaultConfig(forSetStore(loadedConfig)) ? null : undefined))+ : undefined;+ // Held past the first edit, else Save writes into the pinned set. A new load drops it.+ useEffect(() => {+ if (loadedOnce !== undefined) setPickedSet(loadedOnce);+ }, [loadedOnce, setPickedSet]);+ const wantedSet =+ pickedSet !== undefined+ ? pickedSet+ : loadedOnce !== undefined+ ? loadedOnce+ : selectionStale+ ? null+ : (persistedSet ?? null);const selectedEntry =wantedSet === null ? null : findSavedRunSettings(savedSets, wantedSet);const selectedSet = selectedEntry?.name ?? null;- const forSetStore = (next: PerModelConfig) =>- normalizePerModelConfig(storedSpeculativeAuto(next, targetIsMlx));+ const loadsOnce = pinnedSet !== null && selectedSet !== pinnedSet;const setUnsaved =selectedEntry !== null &&(!perModelConfigsEqual(forSetStore(runtimeConfig), forSetStore(selectedEntry.config)) ||- (persistedSet ?? null) !== selectedSet ||- (!matchesStored && !atDefault));+ (!loadsOnce &&+ ((persistedSet ?? null) !== selectedSet || (!matchesStored && !atDefault))));// Arguments a load would refuse, or not read yet: saving them would store what cannot load.const extraArgsBlocked =(!extraArgsLoadable && !sharedExtraArgsCleared) ||@@ -3504,28 +3569,26 @@ export function ModelConfigPage({const canSave = naming? normalizeSavedRunSettingsName(naming.name) !== "": selectedSet === null- ? !atDefault || savedRemember+ ? !atDefault || (savedRemember && !loadsOnce): setUnsaved;+ const pickEdited = selectedSet === null ? !atDefault : setUnsaved;// Always mounted: a status appearing on save would move Load.const saveStatus = naming? ""- : selectedSet === null- ? savedRemember- ? "Saved settings will be forgotten"- : atDefault- ? "Using the default settings"- : "Unsaved changes"- : setUnsaved- ? "Unsaved changes"- : "Saved for this model";- const persistenceOnly = isActiveModel && atBaseline && rememberChanged;- const primaryActionLabel = persistenceOnly- ? remember- ? "Save settings"- : "Forget settings"- : isActiveModel- ? "Reload model"- : "Load model";+ : loadsOnce && !pickEdited+ ? `Loads once. Next loads use ${pinnedSet}.`+ : selectedSet === null+ ? !atDefault+ ? "Unsaved changes"+ : savedRemember+ ? "Saved settings will be forgotten"+ : "Using the default settings"+ : setUnsaved+ ? "Unsaved changes"+ : pinnedSet !== null+ ? "Loads every time"+ : "Saved for this model";+ const primaryActionLabel = isActiveModel ? "Reload model" : "Load model";const [engineReady, setEngineReady] = useState(true);const commitDraft = () => {@@ -3707,13 +3770,21 @@ export function ModelConfigPage({syncOtherQuants(quantsSelectingRunSettings(configId, name), stored);return true;};+ const saveSetError = (name: string) =>+ isRunSettingsLimitReached(configId, name)+ ? `This model already has ${SAVED_RUN_SETTINGS_PER_MODEL_MAX} saved settings. Delete one to save these.`+ : "Couldn't save these settings.";// From the committed config: a number blurred by this very click is not in customName yet.const committedCustomName = (committed: PerModelConfig) =>isDefaultConfig(forSetStore(committed)) ? null : newRunSettingsName(savedSets, modelName);/** Saves without loading; ``into`` null saves an edited Default as its custom set, else forgets. */- const handleSave = (into: string | null = selectedSet, message?: string): boolean => {+ const handleSave = (+ into: string | null = selectedSet,+ message?: string,+ pinned = pinnedSet,+ ): boolean => {if (sharedVariantUnresolved) {return false;}@@ -3724,14 +3795,23 @@ export function ModelConfigPage({const { effectiveRuntimeConfig } = commitDraft();const target = into ?? committedCustomName(effectiveRuntimeConfig);const keep = target !== null;+ // Never a forget while pinned: the pinned set is what loads.+ if (!keep && pinned !== null) {+ return false;+ }if (keep && extraArgsBlocked) {toast.error("Fix the extra arguments before saving.");return false;}if (keep && !saveSharedSet(target, effectiveRuntimeConfig)) {- toast.error("Couldn't save these settings.");+ toast.error(saveSetError(target));return false;}+ if (pinned !== null && target !== pinned) {+ setPickedSet(target);+ toast.success(message ?? `Saved "${target}".`);+ return true;+ }const { saved, defaultConfig } = persistConfig(effectiveRuntimeConfig, keep);if (!saved) {toast.error("Couldn't save settings for this model.");@@ -3772,7 +3852,7 @@ export function ModelConfigPage({};// The model loads with whatever was picked last: picking takes effect without a Save.- const pickSet = (name: string | null) => {+ const pickSet = (name: string | null, pinned = pinnedSet) => {// A load settling its budget already captured its config; a pick now would disagree with it.if (budgetSettling) {return;@@ -3780,6 +3860,11 @@ export function ModelConfigPage({setNaming(null);const entry = name === null ? null : findSavedRunSettings(savedSets, name);const next = entry?.config ?? DEFAULT_PER_MODEL_CONFIG;+ if (pinned !== null && entry?.name !== pinned) {+ applyToPanel(next);+ setPickedSet(entry?.name ?? null);+ return;+ }// What the panel shows, explicit argument clear included: an omitted field keeps the server's old flags.const { saved, defaultConfig } = persistConfig(applyToPanel(next), entry !== null);if (!saved) {@@ -3800,12 +3885,34 @@ export function ModelConfigPage({return;}syncOtherQuants(otherQuants, null);- if (wasSelected) {- pickSet(null);+ if (name === pinnedSet) {+ pickSet(wasSelected ? null : selectedSet, null);+ } else if (wasSelected) {+ pickSet(pinnedSet);}toast.success(`Deleted "${name}".`);};+ const setAlwaysLoad = (on: boolean) => {+ if (!on) {+ setPinnedRunSettings(configId, target.ggufVariant, null);+ return;+ }+ const name = selectedSet ?? customName;+ if (name === null || !setPinnedRunSettings(configId, target.ggufVariant, name)) {+ return;+ }+ const message = `"${name}" now loads every time.`;+ if (selectedSet === null || setUnsaved) {+ if (!handleSave(name, message, name)) {+ setPinnedRunSettings(configId, target.ggufVariant, pinnedSet);+ }+ return;+ }+ pickSet(selectedSet, selectedSet);+ toast.success(message);+ };+// Renames the selected set; an edited Default not saved yet gets named before it is created.const editName =selectedSet !== null@@ -3859,35 +3966,25 @@ export function ModelConfigPage({if (budgetSettling) {return;}- const { effectiveConfig, effectiveRuntimeConfig, effectiveMaxSeqLengthValue } =- commitDraft();- const effectivePersistenceOnly =- isActiveModel &&- perModelConfigsEqual(effectiveConfig, baseline, {- followGlobal: true,- }) &&- rememberChanged;+ const { effectiveRuntimeConfig, effectiveMaxSeqLengthValue } = commitDraft();// Load saves into the set too (an edited Default becomes one), so the two never drift apart.let loadSet = selectedSet ?? committedCustomName(effectiveRuntimeConfig);if (loadSet !== null && !saveSharedSet(loadSet, effectiveRuntimeConfig)) {- toast.error("Couldn't save these settings, loading with them anyway.");+ toast.error(`${saveSetError(loadSet)} Loading with them anyway.`);// Never select a set that was not created.if (loadSet !== selectedSet) {loadSet = null;}}- const { saved, defaultConfig } = persistConfig(effectiveRuntimeConfig, loadSet !== null);- if (saved) {+ const onceOnly = pinnedSet !== null && loadSet !== pinnedSet;+ const { saved } = onceOnly+ ? { saved: true }+ : persistConfig(effectiveRuntimeConfig, loadSet !== null);+ if (onceOnly) {+ setPickedSet(loadSet);+ } else if (saved) {keepSelection(loadSet);}- if (effectivePersistenceOnly) {- if (!saved) {- toast.error("Couldn't save settings for this model.");- return;- }- finishPersist(defaultConfig, loadSet !== null);- return;- }if (!saved) {toast.error("Couldn't save these settings, loading with them anyway.");}@@ -3897,6 +3994,39 @@ export function ModelConfigPage({: { ...effectiveRuntimeConfig, maxSeqLength: effectiveMaxSeqLengthValue };// The budget row flushes on unmount, after onRun staged the load, so save it first. Locked// before the settle so no drag lands in between.+ // Recorded as the runtime resolves it: inherited speculative decoding takes the standing mode.+ const onceSent = {+ ...effectiveLoadConfig,+ speculativeType:+ normalizeSpeculativeType(effectiveLoadConfig.speculativeType) ??+ readPersistedSpeculativeType(),+ };+ noteRunSettingsLoadedOnce(+ configId,+ target.ggufVariant,+ onceOnly ? { name: loadSet, sent: onceSent } : null,+ );+ // The load strips arguments managed since they were saved, so record what it submits.+ const onceArgs = onceSent.llamaExtraArgs;+ if (onceOnly && target.isGguf && classifiedIsDiffusion !== true && onceArgs?.length) {+ void loadManagedLlamaFlags()+ .then((managed) => {+ const cleaned = sanitizeStoredExtraArgs(+ onceArgs,+ managed?.managed ?? new Set<string>(),+ {+ maxBytes: managed?.maxBytes,+ windowsCommandBudget: managed?.windowsCommandBudget,+ },+ );+ if (cleaned.length === onceArgs.length) return;+ noteRunSettingsLoadedOnce(configId, target.ggufVariant, {+ name: loadSet,+ sent: { ...onceSent, llamaExtraArgs: cleaned },+ });+ })+ .catch(() => undefined);+ }setVramBudgetLocked(true);const stagedBudget = settleVramBudgetSave();if (stagedBudget) {@@ -4168,30 +4298,60 @@ export function ModelConfigPage({modelName={modelName}sets={savedSets}selected={selectedSet}+ pinned={pinnedSet}customName={naming ? null : customName}onEditName={editName}compact={variant === "sidebar"}naming={naming}// Until the server copy is read: a pick before then could not forget a row it has not seen.disabled={sharedVariantUnresolved || extraArgsHydrating || budgetSettling}- onPick={pickSet}+ onPick={(name) => pickSet(name)}onNamingChange={setNaming}onNamingSubmit={submitNaming}- onDelete={deleteSet}+ onDelete={setPendingDelete}/>- <p- id={saveStatusId}- aria-live="polite"- data-state={saveStatus === "Unsaved changes" ? "dirty" : undefined}- // min-h keeps the empty line's height, so the buttons never move. Not while naming in the- // sidebar: the name box's own button row already moved them, and the blank line only adds a gap.+ {/* Always rendered so a status change never moves the buttons; the sidebar's name box already does. */}+ <divclassName={cn(- "-mt-2 -mb-1.5 min-h-[calc(1.375em+0.25rem)] min-w-0 truncate pl-3.5 text-ui-11 leading-snug text-muted-foreground data-[state=dirty]:text-amber-600 dark:data-[state=dirty]:text-amber-400",- naming && variant === "sidebar" && "hidden",+ "-mt-1.5 -mb-0.5 flex min-h-[calc(1.375em+0.25rem)] min-w-0 items-center gap-2 pl-3.5",+ naming && (variant === "sidebar" ? "hidden" : "invisible"),)}>- {saveStatus}- </p>+ <Checkbox+ id={alwaysLoadId}+ aria-label="Always load with these settings"+ aria-describedby={saveStatusId}+ checked={selectedSet !== null && selectedSet === pinnedSet}+ disabled={+ naming !== null ||+ (selectedSet === null && customName === null) ||+ sharedVariantUnresolved ||+ extraArgsHydrating ||+ budgetSettling+ }+ onCheckedChange={(checked) => setAlwaysLoad(checked === true)}+ />+ <label+ htmlFor={alwaysLoadId}+ title={+ selectedSet === null && customName === null+ ? "Change a setting or pick a saved one to always load it"+ : "Every load of this model uses these settings, even after you load it once with others"+ }+ className="shrink-0 cursor-pointer select-none text-ui-12 text-muted-foreground peer-disabled:cursor-default peer-disabled:opacity-60"+ >+ {variant === "sidebar" ? "Always load" : "Always load with these settings"}+ </label>+ <p+ id={saveStatusId}+ aria-live="polite"+ data-state={saveStatus === "Unsaved changes" ? "dirty" : undefined}+ className="ml-auto min-w-0 truncate text-ui-11 leading-snug text-muted-foreground data-[state=dirty]:text-amber-600 dark:data-[state=dirty]:text-amber-400"+ title={saveStatus || undefined}+ >+ {saveStatus}+ </p>+ </div><div className="flex flex-wrap items-center gap-2"><Buttonvariant="dark"@@ -4205,42 +4365,43 @@ export function ModelConfigPage({(!extraArgsLoadable && !sharedExtraArgsCleared) ||sharedExtraArgsRefused ||extraArgsHydrating ||- (isActiveModel &&- atBaseline &&- !rememberChanged &&- !budgetReloadRequired)+ (isActiveModel && atBaseline && !budgetReloadRequired)}onClick={handleRun}>{primaryActionLabel}</Button>{/* Saves without loading; an edited Default becomes its custom setting. */}- {!persistenceOnly && (- <Button- type="button"- variant="outline"- size="sm"- // Same gates as Load: an unclassified model or an in-flight budget PUT would persist- // settings the load path strips or has already captured.- disabled={- sharedVariantUnresolved ||- !canSave ||- stagedMetadataPending ||- budgetSettling ||- ((selectedSet !== null || customName !== null) && extraArgsBlocked)- }- onClick={onSaveClick}- >- Save- </Button>- )}+ <Button+ type="button"+ variant="outline"+ size="sm"+ // Same gates as Load: an unclassified model or an in-flight budget PUT would persist+ // settings the load path strips or has already captured.+ disabled={+ sharedVariantUnresolved ||+ !canSave ||+ stagedMetadataPending ||+ budgetSettling ||+ ((selectedSet !== null || customName !== null) && extraArgsBlocked)+ }+ onClick={onSaveClick}+ >+ Save+ </Button><Buttontype="button"variant="outline"size="sm"className="text-muted-foreground"- disabled={(atDefault && selectedSet === null) || extraArgsHydrating || budgetSettling}- onClick={() => pickSet(null)}+ disabled={+ (pinnedSet !== null+ ? selectedSet === pinnedSet && !setUnsaved+ : atDefault && selectedSet === null) ||+ extraArgsHydrating ||+ budgetSettling+ }+ onClick={() => pickSet(pinnedSet)}>Reset</Button>@@ -4299,6 +4460,40 @@ export function ModelConfigPage({</AlertDialogFooter></AlertDialogContent></AlertDialog>+ <AlertDialog+ open={pendingDelete !== null}+ onOpenChange={(open) => {+ if (!open) {+ setPendingDelete(null);+ }+ }}+ >+ <AlertDialogContent size="sm">+ <AlertDialogHeader>+ <AlertDialogTitle>Delete “{pendingDelete}”?</AlertDialogTitle>+ <AlertDialogDescription>+ {pendingDelete !== null &&+ quantsSelectingRunSettings(configId, pendingDelete).length > 0+ ? "Anything that loads with these settings goes back to the default settings."+ : "These saved settings will be removed for this model."}+ </AlertDialogDescription>+ </AlertDialogHeader>+ <AlertDialogFooter>+ <AlertDialogCancel>Cancel</AlertDialogCancel>+ <AlertDialogAction+ variant="destructive"+ onClick={() => {+ if (pendingDelete !== null) {+ deleteSet(pendingDelete);+ }+ setPendingDelete(null);+ }}+ >+ Delete+ </AlertDialogAction>+ </AlertDialogFooter>+ </AlertDialogContent>+ </AlertDialog></div>);}diff --git a/studio/frontend/src/features/model-picker/components/model-selector/pickers.tsx b/studio/frontend/src/features/model-picker/components/model-selector/pickers.tsxindex 19de73956d7..675229d194f 100644--- a/studio/frontend/src/features/model-picker/components/model-selector/pickers.tsx+++ b/studio/frontend/src/features/model-picker/components/model-selector/pickers.tsx@@ -133,7 +133,6 @@ import {Add01Icon,ArrowUpDownIcon,Cancel01Icon,- Copy01Icon,DashboardCircleIcon,Flag01Icon,FlimSlateIcon,@@ -147,6 +146,7 @@ import {Settings02Icon,ViewIcon,} from "@hugeicons/core-free-icons";+import { Copy01Icon } from "@/lib/copy-icon";import { useT } from "@/i18n";import { AiSpeechIcon } from "@/lib/hugeicons-derived";import { HugeiconsIcon } from "@hugeicons/react";diff --git a/studio/frontend/src/features/model-picker/components/saved-run-settings-row.tsx b/studio/frontend/src/features/model-picker/components/saved-run-settings-row.tsxindex 519312fce02..dc0114d9584 100644--- a/studio/frontend/src/features/model-picker/components/saved-run-settings-row.tsx+++ b/studio/frontend/src/features/model-picker/components/saved-run-settings-row.tsx@@ -18,7 +18,12 @@ import {Edit03Icon,} from "@hugeicons/core-free-icons";import { HugeiconsIcon } from "@hugeicons/react";-import type { MouseEvent, PointerEvent } from "react";+import {+ type MouseEvent,+ type PointerEvent,+ useEffect,+ useState,+} from "react";import {SAVED_RUN_SETTINGS_NAME_MAX,type SavedRunSettings,@@ -36,6 +41,7 @@ interface RunSettingsPickerProps {sets: readonly SavedRunSettings[];/** The set the model loads with, or null for the default (recommended) settings. */selected: string | null;+ pinned?: string | null;/** Default with edits: the name they will be saved under. */customName: string | null;/** Null on Default settings, which cannot be renamed. */@@ -78,6 +84,7 @@ export function RunSettingsPicker({modelName,sets,selected,+ pinned = null,customName,onEditName,compact = false,@@ -88,6 +95,25 @@ export function RunSettingsPicker({onNamingSubmit,onDelete,}: RunSettingsPickerProps) {+ const [menuOpen, setMenuOpen] = useState(false);+ const isNaming = naming !== null;+ useEffect(() => {+ if (!isNaming) {+ return;+ }+ // Window capture runs before Radix's document listener, which then skips the prevented Escape.+ const keepPanel = (event: KeyboardEvent) => {+ if (+ event.key === "Escape" &&+ event.target instanceof Element &&+ event.target.closest("[data-run-settings-name]")+ ) {+ event.preventDefault();+ }+ };+ window.addEventListener("keydown", keepPanel, true);+ return () => window.removeEventListener("keydown", keepPanel, true);+ }, [isNaming]);if (naming) {return (// The sidebar is too narrow for a readable name beside the buttons, so they go below it.@@ -99,6 +125,7 @@ export function RunSettingsPicker({><InputautoFocus={true}+ data-run-settings-name=""value={naming.name}onFocus={(event) => event.currentTarget.select()}onChange={(event) =>@@ -149,9 +176,18 @@ export function RunSettingsPicker({</div>);}+ // Closed first: the rename box replaces the menu, and the delete confirmation must not open under it.+ const rename = (name: string) => {+ setMenuOpen(false);+ onNamingChange({ mode: "rename", name, target: name });+ };+ const remove = (name: string) => {+ setMenuOpen(false);+ onDelete(name);+ };return (<div className="flex min-w-0 items-center gap-1.5">- <DropdownMenu>+ <DropdownMenu open={menuOpen} onOpenChange={setMenuOpen}><DropdownMenuTrigger asChild={true} disabled={disabled}><buttontype="button"@@ -193,22 +229,35 @@ export function RunSettingsPicker({key={entry.name}className={cn(ITEM, "pr-1.5")}onSelect={() => onPick(entry.name)}+ aria-keyshortcuts="F2 Delete"+ onKeyDown={(event) => {+ if (event.key === "F2") {+ event.preventDefault();+ rename(entry.name);+ } else if (event.key === "Delete") {+ event.preventDefault();+ remove(entry.name);+ }+ }}><Check on={entry.name === selected} /><span className="min-w-0 flex-1 truncate">{entry.name}</span>+ {entry.name === pinned && (+ <span className="shrink-0 text-ui-11 font-normal text-muted-foreground">+ Always+ </span>+ )}<buttontype="button"aria-label={`Rename ${entry.name}`}+ title="Rename (F2)"+ tabIndex={-1}className={ROW_ICON}onPointerDown={keepRow}onPointerUp={keepRow}onClick={(event) => {keepRow(event);- onNamingChange({- mode: "rename",- name: entry.name,- target: entry.name,- });+ rename(entry.name);}}><HugeiconsIcon@@ -220,12 +269,14 @@ export function RunSettingsPicker({<buttontype="button"aria-label={`Delete ${entry.name}`}+ title="Delete (Del)"+ tabIndex={-1}className={ROW_ICON}onPointerDown={keepRow}onPointerUp={keepRow}onClick={(event) => {keepRow(event);- onDelete(entry.name);+ remove(entry.name);}}><HugeiconsIcondiff --git a/studio/frontend/src/features/model-picker/model-config/model-config-draft.ts b/studio/frontend/src/features/model-picker/model-config/model-config-draft.tsindex ff70adf9415..da3b1e64366 100644--- a/studio/frontend/src/features/model-picker/model-config/model-config-draft.ts+++ b/studio/frontend/src/features/model-picker/model-config/model-config-draft.ts@@ -33,6 +33,8 @@ export type ModelConfigDraftSnapshot = {remember: boolean;savedRemember: boolean;appliedLiveSignature: string;+ /** The set shown while another is pinned, loaded once; absent follows the stored selection. */+ pickedSet?: string | null;};const drafts = new Map<string, ModelConfigDraftSnapshot>();@@ -216,6 +218,18 @@ export function setModelConfigDraftSavedRemember(notify();}+export function setModelConfigDraftPickedSet(+ key: string,+ pickedSet: string | null | undefined,+): void {+ const existing = drafts.get(key);+ if (!existing || existing.pickedSet === pickedSet) {+ return;+ }+ drafts.set(key, { ...existing, pickedSet });+ notify();+}+export function isExtraArgsHydratedForDraft(key: string): boolean {return extraArgsHydratedDrafts.has(key);}diff --git a/studio/frontend/src/features/model-picker/model-config/per-model-config.ts b/studio/frontend/src/features/model-picker/model-config/per-model-config.tsindex a2b3f2c948e..cea77813fdd 100644--- a/studio/frontend/src/features/model-picker/model-config/per-model-config.ts+++ b/studio/frontend/src/features/model-picker/model-config/per-model-config.ts@@ -1523,6 +1523,12 @@ function findModelOverrideKeyOwners(return owners;}+export function modelOverrideKeyOwners(+ overrideKeys: readonly string[],+): { modelId: string; ggufVariant: string | null }[] {+ return overrideKeys.flatMap(findModelOverrideKeyOwners);+}+export function deletePerModelConfigsForOverrideKeys(overrideKeys: readonly string[],): boolean {diff --git a/studio/frontend/src/features/model-picker/model-config/saved-run-settings.ts b/studio/frontend/src/features/model-picker/model-config/saved-run-settings.tsindex e83bfeade84..68bb51c7c86 100644--- a/studio/frontend/src/features/model-picker/model-config/saved-run-settings.ts+++ b/studio/frontend/src/features/model-picker/model-config/saved-run-settings.ts@@ -8,8 +8,10 @@ import { useSyncExternalStore } from "react";import { normalizeModelIdentity } from "./model-identity";import {type PerModelConfig,+ deletePerModelConfigsForOverrideKeys,fromStoredPerModelConfig,isChatTemplateWithinLimit,+ modelOverrideKeyOwners,toStoredPerModelConfig,} from "./per-model-config";@@ -17,6 +19,10 @@ export const SAVED_RUN_SETTINGS_STORAGE_KEY ="unsloth_model_saved_run_settings";export const SELECTED_RUN_SETTINGS_STORAGE_KEY ="unsloth_model_selected_run_settings";+export const PINNED_RUN_SETTINGS_STORAGE_KEY =+ "unsloth_model_pinned_run_settings";+export const LOADED_ONCE_RUN_SETTINGS_STORAGE_KEY =+ "unsloth_model_loaded_once_run_settings";export const SAVED_RUN_SETTINGS_UPDATED_EVENT ="unsloth-saved-run-settings-updated";export const SAVED_RUN_SETTINGS_NAME_MAX = 80;@@ -110,6 +116,10 @@ const SELECTED_VARIANTS_STORAGE_KEY ="unsloth_model_selected_run_settings_variants";const readSelectedVariants = () =>readJson<Record<string, string>>(SELECTED_VARIANTS_STORAGE_KEY);+const readPins = () =>+ readJson<Record<string, string>>(PINNED_RUN_SETTINGS_STORAGE_KEY);+const writePins = (map: Record<string, string>) =>+ writeJson(PINNED_RUN_SETTINGS_STORAGE_KEY, map);function decode(entries: unknown): SavedRunSettings[] {if (!Array.isArray(entries)) {@@ -183,6 +193,18 @@ export function saveRunSettings(return writeMap(map);}+export function isRunSettingsLimitReached(+ modelId: string,+ name: string,+): boolean {+ const cleanName = normalizeSavedRunSettingsName(name);+ return (+ entriesFor(readMap(), modelKey(modelId)).filter(+ (entry) => !named(entry, cleanName),+ ).length >= SAVED_RUN_SETTINGS_PER_MODEL_MAX+ );+}+function selectionsNaming(selections: SelectionMap,modelId: string,@@ -220,6 +242,32 @@ export function renameSavedRunSettings(if (!writeMap(map)) {return false;}+ const pins = readPins();+ const renamedPins = selectionsNaming(pins, modelId, from);+ for (const pinned of renamedPins) {+ pins[pinned] = cleanName;+ }+ if (renamedPins.length > 0) {+ writePins(pins);+ }+ const loadedOnce = readJson<LoadedOnceMap>(+ LOADED_ONCE_RUN_SETTINGS_STORAGE_KEY,+ );+ const prefix = selectionPrefix(modelId);+ const renamedOnce = Object.keys(loadedOnce).filter((once) => {+ const onceName = loadedOnce[once]?.name;+ return (+ once.startsWith(prefix) &&+ typeof onceName === "string" &&+ sameName(onceName, from)+ );+ });+ for (const once of renamedOnce) {+ loadedOnce[once] = { ...loadedOnce[once], name: cleanName };+ }+ if (renamedOnce.length > 0) {+ writeJson(LOADED_ONCE_RUN_SETTINGS_STORAGE_KEY, loadedOnce);+ }const selections = readSelections();const renamed = selectionsNaming(selections, modelId, from);for (const selected of renamed) {@@ -244,6 +292,14 @@ export function deleteSavedRunSettings(modelId: string, name: string): boolean {return false;}}+ const pins = readPins();+ const unpinned = selectionsNaming(pins, modelId, name);+ for (const pinned of unpinned) {+ delete pins[pinned];+ }+ if (unpinned.length > 0) {+ writePins(pins);+ }const selections = readSelections();const dropped = selectionsNaming(selections, modelId, name);// Default, not unchosen: an unchosen quant would adopt its remembered record back into a set.@@ -309,6 +365,109 @@ export function setSelectedRunSettings(return writeSelections(selections);}+/** Back on Default too: a selection left behind would show a set that no longer loads. */+export function forgetPerModelConfigsForOverrideKeys(+ overrideKeys: readonly string[],+): boolean {+ const selections = readSelections();+ const pins = readPins();+ let changed = false;+ let unpinned = false;+ for (const { modelId, ggufVariant } of modelOverrideKeyOwners(overrideKeys)) {+ const key = selectionKey(modelId, ggufVariant);+ if (typeof selections[key] === "string") {+ selections[key] = null;+ changed = true;+ }+ if (key in pins) {+ delete pins[key];+ unpinned = true;+ }+ }+ if (unpinned) {+ writePins(pins);+ }+ if (changed) {+ writeSelections(selections);+ }+ return deletePerModelConfigsForOverrideKeys(overrideKeys);+}++// The set a one-time load used and what it sent: the runtime reports resolved values, so sets alone+// miss it. Stored, as the model stays loaded across a refresh.+type LoadedOnceMap = Record<string, { name: unknown; sent: unknown }>;++export function noteRunSettingsLoadedOnce(+ modelId: string,+ ggufVariant: string | null | undefined,+ entry: { name: string | null; sent: PerModelConfig } | null,+): void {+ const key = selectionKey(modelId, ggufVariant);+ const map = readJson<LoadedOnceMap>(LOADED_ONCE_RUN_SETTINGS_STORAGE_KEY);+ if (!entry && !(key in map)) return;+ if (entry) {+ map[key] = { name: entry.name, sent: toStoredPerModelConfig(entry.sent) };+ } else {+ delete map[key];+ }+ writeJson(LOADED_ONCE_RUN_SETTINGS_STORAGE_KEY, map);+}++export function getRunSettingsLoadedOnce(+ modelId: string,+ ggufVariant: string | null | undefined,+): { name: string | null; sent: PerModelConfig } | null {+ const entry = readJson<LoadedOnceMap>(LOADED_ONCE_RUN_SETTINGS_STORAGE_KEY)[+ selectionKey(modelId, ggufVariant)+ ];+ const sent = entry ? fromStoredPerModelConfig(entry.sent) : null;+ if (+ !entry ||+ !sent ||+ (entry.name !== null && typeof entry.name !== "string")+ ) {+ return null;+ }+ return { name: entry.name, sent };+}++export function getPinnedRunSettings(+ modelId: string,+ ggufVariant: string | null | undefined,+): string | null {+ const value = readPins()[selectionKey(modelId, ggufVariant)];+ return typeof value === "string" ? value : null;+}++export function setPinnedRunSettings(+ modelId: string,+ ggufVariant: string | null | undefined,+ name: string | null,+): boolean {+ const pins = readPins();+ const key = selectionKey(modelId, ggufVariant);+ if ((pins[key] ?? null) === name) {+ return true;+ }+ if (name === null) {+ delete pins[key];+ } else {+ pins[key] = name;+ }+ return writePins(pins);+}++export function usePinnedRunSettings(+ modelId: string,+ ggufVariant: string | null | undefined,+): string | null {+ return useSyncExternalStore(+ subscribeSavedRunSettings,+ () => getPinnedRunSettings(modelId, ggufVariant),+ () => null,+ );+}+/** "<model> custom settings", numbered past the names already taken. */export function newRunSettingsName(list: readonly SavedRunSettings[],@@ -329,48 +488,6 @@ function withSuffix(base: string, suffix: string): string {);}-// Names earlier builds gave sets: an adopted record, then "Custom setting for <model>[ N]".-const LEGACY_ADOPTED_NAME = "Saved settings";--function legacyRename(- name: string,- list: readonly SavedRunSettings[],- modelName: string,-): string | null {- if (sameName(name, LEGACY_ADOPTED_NAME)) {- return newRunSettingsName(list, modelName);- }- const old = `Custom setting for ${modelName}`;- const suffix = name.slice(old.length);- if (!sameName(name.slice(0, old.length), old) || !/^( \d+)?$/.test(suffix)) {- return null;- }- return withSuffix(`${modelName} custom settings`, suffix);-}--export function hasLegacyRunSettings(- list: readonly SavedRunSettings[],- modelName: string,-): boolean {- return list.some(- (entry) => legacyRename(entry.name, list, modelName) !== null,- );-}--export function renameLegacyRunSettings(- modelId: string,- modelName: string,-): string[] {- const renamed: string[] = [];- for (const { name } of listSavedRunSettings(modelId)) {- const to = legacyRename(name, listSavedRunSettings(modelId), modelName);- if (to !== null && renameSavedRunSettings(modelId, name, to)) {- renamed.push(to);- }- }- return renamed;-}-/** Remembered settings saved before named sets existed: list them as a set and select it. Returns its name. */export function adoptRememberedRunSettings(modelId: string,@@ -399,7 +516,8 @@ export function subscribeSavedRunSettings(onChange: () => void): () => void {if (event.key === null ||event.key === SAVED_RUN_SETTINGS_STORAGE_KEY ||- event.key === SELECTED_RUN_SETTINGS_STORAGE_KEY+ event.key === SELECTED_RUN_SETTINGS_STORAGE_KEY ||+ event.key === PINNED_RUN_SETTINGS_STORAGE_KEY) {cache.clear();onChange();diff --git a/studio/frontend/src/features/recipe-studio/components/executions/publish-execution-dialog.tsx b/studio/frontend/src/features/recipe-studio/components/executions/publish-execution-dialog.tsxindex 3ffe6cdbd6e..619921f1d68 100644--- a/studio/frontend/src/features/recipe-studio/components/executions/publish-execution-dialog.tsx+++ b/studio/frontend/src/features/recipe-studio/components/executions/publish-execution-dialog.tsx@@ -5,9 +5,9 @@ import { ChevronRightStandardIcon } from "@/lib/chevron-icons";import { useEffect, useMemo, useState, type ReactElement } from "react";import {CheckmarkCircle02Icon,- Copy01Icon,Key01Icon,} from "@hugeicons/core-free-icons";+import { Copy01Icon } from "@/lib/copy-icon";import { HugeiconsIcon } from "@hugeicons/react";import { Button } from "@/components/ui/button";import {diff --git a/studio/frontend/src/features/scheduled-tasks/tasks-page.tsx b/studio/frontend/src/features/scheduled-tasks/tasks-page.tsxindex d7629eddec4..cbdfbecbc40 100644--- a/studio/frontend/src/features/scheduled-tasks/tasks-page.tsx+++ b/studio/frontend/src/features/scheduled-tasks/tasks-page.tsx@@ -9,8 +9,8 @@ import {PencilEdit02Icon,Search01Icon,Clock01Icon,- PauseIcon,} from "@hugeicons/core-free-icons";+import { PauseIcon } from "@/lib/media-control-icons";import { HugeiconsIcon } from "@hugeicons/react";import { useNavigate, useSearch } from "@tanstack/react-router";import { PlayIcon } from "lucide-react";diff --git a/studio/frontend/src/features/settings/components/agent-command-block.tsx b/studio/frontend/src/features/settings/components/agent-command-block.tsxindex 466452f89c9..78d8452eb05 100644--- a/studio/frontend/src/features/settings/components/agent-command-block.tsx+++ b/studio/frontend/src/features/settings/components/agent-command-block.tsx@@ -6,7 +6,7 @@ import { useT } from "@/i18n";import { copyToClipboard } from "@/lib/copy-to-clipboard";import { Tick02Icon } from "@/lib/tick-icon";import { cn } from "@/lib/utils";-import { Copy01Icon } from "@hugeicons/core-free-icons";+import { Copy01Icon } from "@/lib/copy-icon";import { HugeiconsIcon } from "@hugeicons/react";import { useEffect, useMemo, useRef, useState } from "react";import { ApiProviderLogo } from "../../chat/api-provider-logo";diff --git a/studio/frontend/src/features/settings/components/api-example-parts.tsx b/studio/frontend/src/features/settings/components/api-example-parts.tsxindex b6458aea03a..9fc99ea71ac 100644--- a/studio/frontend/src/features/settings/components/api-example-parts.tsx+++ b/studio/frontend/src/features/settings/components/api-example-parts.tsx@@ -16,7 +16,7 @@ import type { TranslationKey } from "@/i18n";import { copyToClipboard } from "@/lib/copy-to-clipboard";import { Tick02Icon } from "@/lib/tick-icon";import { cn } from "@/lib/utils";-import { Copy01Icon } from "@hugeicons/core-free-icons";+import { Copy01Icon } from "@/lib/copy-icon";import { HugeiconsIcon } from "@hugeicons/react";import {type CSSProperties,diff --git a/studio/frontend/src/features/settings/components/api-jump-links.tsx b/studio/frontend/src/features/settings/components/api-jump-links.tsxnew file mode 100644index 00000000000..379410b3fdc--- /dev/null+++ b/studio/frontend/src/features/settings/components/api-jump-links.tsx@@ -0,0 +1,91 @@+// 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/api-key-row.tsx b/studio/frontend/src/features/settings/components/api-key-row.tsxindex 519dbd7ed02..77da384f84b 100644--- a/studio/frontend/src/features/settings/components/api-key-row.tsx+++ b/studio/frontend/src/features/settings/components/api-key-row.tsx@@ -13,11 +13,11 @@ import { copyToClipboard } from "@/lib/copy-to-clipboard";import { toast } from "@/lib/toast";import { cn } from "@/lib/utils";import {- Copy01Icon,Delete02Icon,Refresh01Icon,MoreHorizontalIcon,} from "@hugeicons/core-free-icons";+import { Copy01Icon } from "@/lib/copy-icon";import { HugeiconsIcon } from "@hugeicons/react";import type { ApiKey } from "../api/api-keys";diff --git a/studio/frontend/src/features/settings/components/audio-api-examples.tsx b/studio/frontend/src/features/settings/components/audio-api-examples.tsxindex 00b3dc2645e..3e16abcb727 100644--- a/studio/frontend/src/features/settings/components/audio-api-examples.tsx+++ b/studio/frontend/src/features/settings/components/audio-api-examples.tsx@@ -80,8 +80,10 @@ export function AudioApiExamples({useTunnel,keylessScope = "off",keylessExposure = null,+ showHeading = true,}: {apiKey?: string | null;+ showHeading?: boolean;useTunnel: boolean;keylessScope?: KeylessApiAccessScope;keylessExposure?: KeylessApiAccessExposure | null;@@ -128,7 +130,8 @@ export function AudioApiExamples({}, [audioApiRequested]);useEffect(() => {- if (scrollTarget !== "api-keys-audio-api") return;+ // The API page's copy (no heading) must not answer, or the dialog's never scrolls.+ if (!showHeading || scrollTarget !== "api-keys-audio-api") return;const section = sectionRef.current;if (!section) return;// Consumed only after the user scrolls: clearing it re-runs this effect, whose cleanup stops the pinning.@@ -151,7 +154,7 @@ export function AudioApiExamples({window.clearTimeout(timer);for (const name of events) window.removeEventListener(name, release);};- }, [scrollTarget]);+ }, [scrollTarget, showHeading]);useEffect(() => watchAudioModels(listOpenAIAudioModels, setModels), []);@@ -247,10 +250,12 @@ export function AudioApiExamples({className="flex min-w-0 max-w-full scroll-mt-6 flex-col gap-4"><div className="flex flex-col gap-1">- <h2 className="settings-heading flex items-center gap-2 text-base font-semibold font-heading">- <HugeiconsIcon icon={AiSpeechIcon} strokeWidth={1.75} className="size-[calc(18px*var(--ui-space-scale,1))] shrink-0 text-muted-foreground" />- {t("settings.apiKeys.audioApi.title")}- </h2>+ {showHeading && (+ <h2 className="settings-heading flex items-center gap-2 text-base font-semibold font-heading">+ <HugeiconsIcon icon={AiSpeechIcon} strokeWidth={1.75} className="size-[calc(18px*var(--ui-space-scale,1))] shrink-0 text-muted-foreground" />+ {t("settings.apiKeys.audioApi.title")}+ </h2>+ )}<p className="text-xs leading-relaxed text-muted-foreground">{t("settings.apiKeys.audioApi.description")}</p>diff --git a/studio/frontend/src/features/settings/components/decision-api-section.tsx b/studio/frontend/src/features/settings/components/decision-api-section.tsxindex 349e4a038d8..249bd97a42a 100644--- a/studio/frontend/src/features/settings/components/decision-api-section.tsx+++ b/studio/frontend/src/features/settings/components/decision-api-section.tsx@@ -40,10 +40,8 @@ import {import { translate, useT } from "@/i18n";import { toast } from "@/lib/toast";import { cn } from "@/lib/utils";-import {- ArrowUpRight01Icon,- TaskDone01Icon,-} from "@hugeicons/core-free-icons";+import { scrollIntoPane } from "../lib/scroll-into-pane";+import { ArrowUpRight01Icon, TaskDone01Icon } from "@hugeicons/core-free-icons";import { HugeiconsIcon } from "@hugeicons/react";import { type ReactElement, useEffect, useRef, useState } from "react";import { useSettingsDialogStore } from "../stores/settings-dialog-store";@@ -85,7 +83,11 @@ function errorMessage(error: unknown): string | null {return error instanceof Error ? error.message : null;}-export function DecisionApiSection(): ReactElement | null {+export function DecisionApiSection({+ showHeading = true,+}: {+ showHeading?: boolean;+} = {}): ReactElement | null {const t = useT();const [settings, setSettings] = useState<SystemOneSettings | null>(null);const [connections, setConnections] = useState<SystemOneConnection[] | null>(@@ -152,18 +154,17 @@ export function DecisionApiSection(): ReactElement | null {}, []);useEffect(() => {- if (scrollTarget !== "api-keys-decision-api" || !settings) return;+ // The API page's copy (no heading) must not answer, or the dialog's never scrolls.+ if (!showHeading || scrollTarget !== "api-keys-decision-api" || !settings)+ return;const frame = window.requestAnimationFrame(() => {- sectionRef.current?.scrollIntoView({- block: "start",- behavior: "smooth",- });+ if (sectionRef.current) scrollIntoPane(sectionRef.current);useSettingsDialogStore.getState().consumeScrollTarget("api-keys-decision-api");});return () => window.cancelAnimationFrame(frame);- }, [scrollTarget, settings]);+ }, [scrollTarget, settings, showHeading]);useEffect(() => {if (!enabled) return;@@ -347,77 +348,73 @@ export function DecisionApiSection(): ReactElement | null {};const header = (- <>- <div className="flex items-start gap-3 bg-muted/30 p-4">- <div className="flex size-8 shrink-0 items-center justify-center icon-disc">- <HugeiconsIcon- icon={TaskDone01Icon}- className="size-4 text-foreground"- />- </div>- <div className="flex min-w-0 flex-1 flex-col gap-0.5">- <div className="flex min-w-0 items-baseline gap-2">- <h2 className="settings-heading text-base font-semibold font-heading">+ <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 && (+ <h2 className="settings-heading flex items-center gap-2 text-base font-semibold font-heading">+ <HugeiconsIcon+ icon={TaskDone01Icon}+ strokeWidth={1.75}+ className="size-[calc(18px*var(--ui-space-scale,1))] shrink-0 text-muted-foreground"+ />{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>- <p className="text-xs text-muted-foreground leading-relaxed">- {t("settings.apiKeys.decisionApi.description")}- </p>+ )}+ {/* 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>- {settings ? (- <Tooltip>- <TooltipTrigger asChild={true}>- <span className="shrink-0">- <Button- size="sm"- className="shrink-0 gap-1.5"- disabled={!enabled}- onClick={() => setTryOpen(true)}- >- <PlayIcon- strokeWidth={2}- className="size-3.5"- />- {t("decisions.tryIt")}- </Button>- </span>- </TooltipTrigger>- {enabled ? null : (- <TooltipContent side="bottom">- {t("decisions.tryItOff")}- </TooltipContent>- )}- </Tooltip>- ) : null}- </div>-- {error ? (- <p className="border-t border-border/60 px-4 py-2.5 text-xs leading-snug text-destructive">- {error}+ <p className="text-xs leading-relaxed text-muted-foreground">+ {t("settings.apiKeys.decisionApi.description")}</p>+ </div>+ {settings ? (+ <Tooltip>+ <TooltipTrigger asChild={true}>+ <span className="shrink-0">+ <Button+ size="sm"+ className="shrink-0 gap-1.5"+ disabled={!enabled}+ onClick={() => setTryOpen(true)}+ >+ <PlayIcon strokeWidth={2} className="size-3.5" />+ {t("decisions.tryIt")}+ </Button>+ </span>+ </TooltipTrigger>+ {enabled ? null : (+ <TooltipContent side="bottom">+ {t("decisions.tryItOff")}+ </TooltipContent>+ )}+ </Tooltip>) : null}- </>+ </div>);+ const errorLine = error ? (+ <p className="px-4 py-2.5 text-xs leading-snug text-destructive">{error}</p>+ ) : null;if (!settings) {return error ? (<sectiondata-settings-label={t("settings.apiKeys.decisionApi.title")}- className="overflow-hidden rounded-xl border border-border/70"+ className="flex min-w-0 max-w-full flex-col gap-4">{header}+ <div className="overflow-hidden rounded-xl border border-border/70">+ {errorLine}+ </div></section>) : null;}@@ -490,268 +487,271 @@ export function DecisionApiSection(): ReactElement | null {<sectionref={sectionRef}data-settings-label={t("settings.apiKeys.decisionApi.title")}- className="overflow-hidden rounded-xl border border-border/70"+ className="flex min-w-0 max-w-full scroll-mt-6 flex-col gap-4">{header}- <div className="border-t border-border/60 px-4 py-1">- <SettingsRow- label={t("settings.apiKeys.decisionApi.enable")}- description={- settings.enabledLocked- ? t("settings.apiKeys.decisionApi.lockedByEnv", {- name: ENV_DISABLE,- })- : isRemote- ? t("settings.apiKeys.decisionApi.enableRemoteDescription")- : t("settings.apiKeys.decisionApi.enableDescription")- }- >- <Switch- checked={enabled}- disabled={busy || settings.enabledLocked}- onCheckedChange={(on) => void apply({ enabled: on }, on)}- aria-label={t("settings.apiKeys.decisionApi.enable")}- />- </SettingsRow>+ <div className="overflow-hidden rounded-xl border border-border/70">+ {errorLine}+ <div className={cn("px-4 py-1", error && "border-t border-border/60")}>+ <SettingsRow+ label={t("settings.apiKeys.decisionApi.enable")}+ description={+ settings.enabledLocked+ ? t("settings.apiKeys.decisionApi.lockedByEnv", {+ name: ENV_DISABLE,+ })+ : isRemote+ ? t("settings.apiKeys.decisionApi.enableRemoteDescription")+ : t("settings.apiKeys.decisionApi.enableDescription")+ }+ >+ <Switch+ checked={enabled}+ disabled={busy || settings.enabledLocked}+ onCheckedChange={(on) => void apply({ enabled: on }, on)}+ aria-label={t("settings.apiKeys.decisionApi.enable")}+ />+ </SettingsRow>- <SettingsRow- label={t("settings.apiKeys.decisionApi.model")}- hint={- settings.modelLocked- ? t("settings.apiKeys.decisionApi.lockedByEnv", {- name: ENV_MODEL,- })- : undefined- }- description={- (enabled || isRemote) && status ? (- <span- className={cn(- "flex min-w-0 items-center gap-2",- tone === "error" && "text-destructive",- )}- >- {tone ? (- <span- className={cn(- "size-1.5 shrink-0 rounded-full",- tone === "pending"- ? "animate-pulse bg-current"- : tone === "ready"- ? "bg-emerald-500"- : "bg-destructive",- )}- />- ) : null}- <span className="truncate" title={status}>- {status}- </span>- </span>- ) : undefined- }- className="max-[420px]:flex-col max-[420px]:items-stretch max-[420px]:gap-3"- >- <div className="flex items-center gap-2 max-[420px]:w-full">- {action === "download" ? (- <Button- variant="outline"- size="sm"- className="shrink-0 text-xs"- disabled={busy || downloading}- onClick={() => plan && void startDownload(plan)}- >- {downloading ? <Spinner className="mr-1.5" /> : null}- {t("settings.apiKeys.decisionApi.download")}- </Button>- ) : action === "unload" ? (- <Button- variant="outline"- size="sm"- className="shrink-0 text-xs"- disabled={busy}- onClick={() => void unload()}- >- {t("settings.apiKeys.decisionApi.unload")}- </Button>- ) : null}- {knownModel ? (- <Select- value={settings.model}- disabled={busy || settings.modelLocked}- onValueChange={(name) => void apply({ model: name }, true)}- >- <SelectTrigger+ <SettingsRow+ label={t("settings.apiKeys.decisionApi.model")}+ hint={+ settings.modelLocked+ ? t("settings.apiKeys.decisionApi.lockedByEnv", {+ name: ENV_MODEL,+ })+ : undefined+ }+ description={+ (enabled || isRemote) && status ? (+ <spanclassName={cn(- longLabel ? "w-64" : "w-48",- "max-[420px]:flex-1",+ "flex min-w-0 items-center gap-2",+ tone === "error" && "text-destructive",)}- aria-label={t("settings.apiKeys.decisionApi.model")}- title={longLabel ? modelLabel(settings.model) : undefined}>- <SelectValue className="min-w-0">- <span className="truncate">- {modelLabel(settings.model)}- </span>- </SelectValue>- </SelectTrigger>- <SelectContent>- <SelectGroup>- <SelectLabel>- {t("settings.apiKeys.decisionApi.thisMachine")}- </SelectLabel>- {settings.models.map((option) => (- <SelectItem- key={option.name}- value={option.name}- disabled={!option.available}- title={option.unavailableReason ?? option.description}- >- <span className="flex items-center gap-2">- {modelLabel(option.name)}- {option.kind === "fine_tune" ? null : (- <span className="text-ui-10 tabular-nums text-muted-foreground">- {formatBytes(option.downloadBytes)}- </span>- )}- {option.name === RECOMMENDED_MODEL ? (- <span className="rounded-full bg-emerald-500/12 px-1.5 py-px text-ui-9 font-medium text-emerald-600 dark:text-emerald-400">- {t("settings.apiKeys.decisionApi.recommended")}- </span>- ) : null}- </span>- </SelectItem>- ))}- </SelectGroup>- {connectionGroups.map((group) => (- <SelectGroup key={group[0].providerId}>- <SelectLabel>{group[0].provider}</SelectLabel>- {group.map((option) => (- <SelectItem key={option.name} value={option.name}>- {option.model}+ {tone ? (+ <span+ className={cn(+ "size-1.5 shrink-0 rounded-full",+ tone === "pending"+ ? "animate-pulse bg-current"+ : tone === "ready"+ ? "bg-emerald-500"+ : "bg-destructive",+ )}+ />+ ) : null}+ <span className="truncate" title={status}>+ {status}+ </span>+ </span>+ ) : undefined+ }+ className="max-[420px]:flex-col max-[420px]:items-stretch max-[420px]:gap-3"+ >+ <div className="flex items-center gap-2 max-[420px]:w-full">+ {action === "download" ? (+ <Button+ variant="outline"+ size="sm"+ className="shrink-0 text-xs"+ disabled={busy || downloading}+ onClick={() => plan && void startDownload(plan)}+ >+ {downloading ? <Spinner className="mr-1.5" /> : null}+ {t("settings.apiKeys.decisionApi.download")}+ </Button>+ ) : action === "unload" ? (+ <Button+ variant="outline"+ size="sm"+ className="shrink-0 text-xs"+ disabled={busy}+ onClick={() => void unload()}+ >+ {t("settings.apiKeys.decisionApi.unload")}+ </Button>+ ) : null}+ {knownModel ? (+ <Select+ value={settings.model}+ disabled={busy || settings.modelLocked}+ onValueChange={(name) => void apply({ model: name }, true)}+ >+ <SelectTrigger+ className={cn(+ longLabel ? "w-64" : "w-48",+ "max-[420px]:flex-1",+ )}+ aria-label={t("settings.apiKeys.decisionApi.model")}+ title={longLabel ? modelLabel(settings.model) : undefined}+ >+ <SelectValue className="min-w-0">+ <span className="truncate">+ {modelLabel(settings.model)}+ </span>+ </SelectValue>+ </SelectTrigger>+ <SelectContent>+ <SelectGroup>+ <SelectLabel>+ {t("settings.apiKeys.decisionApi.thisMachine")}+ </SelectLabel>+ {settings.models.map((option) => (+ <SelectItem+ key={option.name}+ value={option.name}+ disabled={!option.available}+ title={option.unavailableReason ?? option.description}+ >+ <span className="flex items-center gap-2">+ {modelLabel(option.name)}+ {option.kind === "fine_tune" ? null : (+ <span className="text-ui-10 tabular-nums text-muted-foreground">+ {formatBytes(option.downloadBytes)}+ </span>+ )}+ {option.name === RECOMMENDED_MODEL ? (+ <span className="rounded-full bg-emerald-500/12 px-1.5 py-px text-ui-9 font-medium text-emerald-600 dark:text-emerald-400">+ {t("settings.apiKeys.decisionApi.recommended")}+ </span>+ ) : null}+ </span></SelectItem>))}</SelectGroup>- ))}- </SelectContent>- </Select>- ) : (- <span className="font-mono text-xs text-foreground">- {settings.model}- </span>- )}- </div>- </SettingsRow>+ {connectionGroups.map((group) => (+ <SelectGroup key={group[0].providerId}>+ <SelectLabel>{group[0].provider}</SelectLabel>+ {group.map((option) => (+ <SelectItem key={option.name} value={option.name}>+ {option.model}+ </SelectItem>+ ))}+ </SelectGroup>+ ))}+ </SelectContent>+ </Select>+ ) : (+ <span className="font-mono text-xs text-foreground">+ {settings.model}+ </span>+ )}+ </div>+ </SettingsRow>- {runtimeChoice ? (- <>+ {runtimeChoice ? (+ <>+ <SettingsRow+ label={t("settings.apiKeys.decisionApi.backend")}+ description={t(+ settings.mlxAvailable+ ? "settings.apiKeys.decisionApi.backendDescriptionMlx"+ : "settings.apiKeys.decisionApi.backendDescription",+ )}+ >+ <Select+ value={backend}+ disabled={busy}+ onValueChange={(value) =>+ void apply({ backend: value as SystemOneBackend }, true)+ }+ >+ <SelectTrigger+ className="w-36"+ aria-label={t("settings.apiKeys.decisionApi.backend")}+ >+ <SelectValue />+ </SelectTrigger>+ <SelectContent>+ <SelectItem value="auto">+ {t("settings.apiKeys.decisionApi.backendAuto")}+ </SelectItem>+ <SelectItem value="llama.cpp">llama.cpp</SelectItem>+ {settings.mlxAvailable || backend === "mlx" ? (+ <SelectItem value="mlx">+ {decisionRuntimeLabel("mlx")}+ </SelectItem>+ ) : null}+ <SelectItem value="pytorch">PyTorch</SelectItem>+ </SelectContent>+ </Select>+ </SettingsRow>+ <p+ className="pb-3 text-xs text-muted-foreground leading-relaxed"+ data-decision-backend+ >+ {t("settings.apiKeys.decisionApi.backendStatus", {+ backend: decisionRuntimeLabel(+ (settings.loadedModel === settings.model+ ? settings.loadedBackend+ : settings.effectiveBackend) ??+ t("settings.apiKeys.decisionApi.backendNone"),+ ),+ })}+ {settings.fallbackReason ? ` · ${settings.fallbackReason}` : ""}{" "}+ {t(+ settings.inputModalities.includes("image")+ ? "settings.apiKeys.decisionApi.mediaImages"+ : "settings.apiKeys.decisionApi.mediaText",+ )}+ </p>+ </>+ ) : null}++ {isRemote ? null : (<SettingsRow- label={t("settings.apiKeys.decisionApi.backend")}- description={t(- settings.mlxAvailable- ? "settings.apiKeys.decisionApi.backendDescriptionMlx"- : "settings.apiKeys.decisionApi.backendDescription",- )}+ label={t("settings.apiKeys.decisionApi.device")}+ description={+ settings.deviceLocked+ ? t("settings.apiKeys.decisionApi.lockedByEnv", {+ name: ENV_DEVICE,+ })+ : t("settings.apiKeys.decisionApi.deviceDescription")+ }><Select- value={backend}- disabled={busy}- onValueChange={(value) =>- void apply({ backend: value as SystemOneBackend }, true)+ value={settings.device}+ disabled={busy || settings.deviceLocked}+ onValueChange={(device) =>+ void apply({ device: device as SystemOneDevice }, false)}><SelectTriggerclassName="w-36"- aria-label={t("settings.apiKeys.decisionApi.backend")}+ aria-label={t("settings.apiKeys.decisionApi.device")}><SelectValue /></SelectTrigger><SelectContent>- <SelectItem value="auto">- {t("settings.apiKeys.decisionApi.backendAuto")}+ <SelectItem value="cpu">+ {t("settings.apiKeys.decisionApi.deviceCpu")}+ </SelectItem>+ <SelectItem value="gpu" disabled={!settings.gpuAvailable}>+ {t("settings.apiKeys.decisionApi.deviceGpu")}</SelectItem>- <SelectItem value="llama.cpp">llama.cpp</SelectItem>- {settings.mlxAvailable || backend === "mlx" ? (- <SelectItem value="mlx">- {decisionRuntimeLabel("mlx")}- </SelectItem>- ) : null}- <SelectItem value="pytorch">PyTorch</SelectItem></SelectContent></Select></SettingsRow>- <p- className="pb-3 text-xs text-muted-foreground leading-relaxed"- data-decision-backend- >- {t("settings.apiKeys.decisionApi.backendStatus", {- backend: decisionRuntimeLabel(- (settings.loadedModel === settings.model- ? settings.loadedBackend- : settings.effectiveBackend) ??- t("settings.apiKeys.decisionApi.backendNone"),- ),- })}- {settings.fallbackReason ? ` · ${settings.fallbackReason}` : ""}{" "}- {t(- settings.inputModalities.includes("image")- ? "settings.apiKeys.decisionApi.mediaImages"- : "settings.apiKeys.decisionApi.mediaText",- )}- </p>- </>- ) : null}+ )}- {isRemote ? null : (- <SettingsRow- label={t("settings.apiKeys.decisionApi.device")}- description={- settings.deviceLocked- ? t("settings.apiKeys.decisionApi.lockedByEnv", {- name: ENV_DEVICE,- })- : t("settings.apiKeys.decisionApi.deviceDescription")- }- >- <Select- value={settings.device}- disabled={busy || settings.deviceLocked}- onValueChange={(device) =>- void apply({ device: device as SystemOneDevice }, false)- }- >- <SelectTrigger- className="w-36"- aria-label={t("settings.apiKeys.decisionApi.device")}+ {connections?.length === 0 && !settings.modelLocked ? (+ <p className="pb-3 text-xs text-muted-foreground">+ {t("settings.apiKeys.decisionApi.addConnection")}{" "}+ <button+ type="button"+ className="font-medium text-foreground underline underline-offset-2 hover:text-primary"+ onClick={() =>+ useSettingsDialogStore.getState().setActiveTab("connections")+ }>- <SelectValue />- </SelectTrigger>- <SelectContent>- <SelectItem value="cpu">- {t("settings.apiKeys.decisionApi.deviceCpu")}- </SelectItem>- <SelectItem value="gpu" disabled={!settings.gpuAvailable}>- {t("settings.apiKeys.decisionApi.deviceGpu")}- </SelectItem>- </SelectContent>- </Select>- </SettingsRow>- )}-- {connections?.length === 0 && !settings.modelLocked ? (- <p className="pb-3 text-xs text-muted-foreground">- {t("settings.apiKeys.decisionApi.addConnection")}{" "}- <button- type="button"- className="font-medium text-foreground underline underline-offset-2 hover:text-primary"- onClick={() =>- useSettingsDialogStore.getState().setActiveTab("connections")- }- >- {t("settings.apiKeys.decisionApi.openConnections")}- </button>- </p>- ) : null}+ {t("settings.apiKeys.decisionApi.openConnections")}+ </button>+ </p>+ ) : null}+ </div></div><DecisionTryDialogdiff --git a/studio/frontend/src/features/settings/components/key-reveal-card.tsx b/studio/frontend/src/features/settings/components/key-reveal-card.tsxindex 722e5d38831..07edd06a8e2 100644--- a/studio/frontend/src/features/settings/components/key-reveal-card.tsx+++ b/studio/frontend/src/features/settings/components/key-reveal-card.tsx@@ -6,7 +6,7 @@ import { useT } from "@/i18n";import { copyToClipboard } from "@/lib/copy-to-clipboard";import { Tick02Icon } from "@/lib/tick-icon";import { cn } from "@/lib/utils";-import { Copy01Icon } from "@hugeicons/core-free-icons";+import { Copy01Icon } from "@/lib/copy-icon";import { HugeiconsIcon } from "@hugeicons/react";import { useEffect, useRef, useState } from "react";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.tsxnew file mode 100644index 00000000000..c96a569f2f4--- /dev/null+++ b/studio/frontend/src/features/settings/components/keyless-api-access-link.tsx@@ -0,0 +1,33 @@+// 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 { ChevronRightStandardIcon } from "@/lib/chevron-icons";+import { HugeiconsIcon } from "@hugeicons/react";+import { useSettingsDialogStore } from "../stores/settings-dialog-store";+import { SettingsSection } from "./settings-section";++// 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"+ 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>+ );+}diff --git a/studio/frontend/src/features/settings/components/mcp-access-section.tsx b/studio/frontend/src/features/settings/components/mcp-access-section.tsxindex 566c86eca70..e971e030ea5 100644--- a/studio/frontend/src/features/settings/components/mcp-access-section.tsx+++ b/studio/frontend/src/features/settings/components/mcp-access-section.tsx@@ -10,12 +10,12 @@ import {SelectValue,} from "@/components/ui/select";import { Switch } from "@/components/ui/switch";+import { McpServerIcon } from "@hugeicons/core-free-icons";+import { HugeiconsIcon } from "@hugeicons/react";import { usePlatformStore } from "@/config/env";import { translate, useT } from "@/i18n";import { isTauri } from "@/lib/api-base";import { cn } from "@/lib/utils";-import { McpServerIcon } from "@hugeicons/core-free-icons";-import { HugeiconsIcon } from "@hugeicons/react";import {type ReactElement,useEffect,@@ -143,41 +143,30 @@ export function McpAccessSection({const agentDetails = detailsFor(agent);return (- <section+ <divdata-settings-label={t("settings.apiKeys.mcp.title")}- className="overflow-hidden rounded-xl border border-border/70"+ className="flex min-w-0 flex-col">- <div className="flex items-start gap-3 bg-muted/30 p-4">- <div className="flex size-8 shrink-0 items-center justify-center icon-disc">- <HugeiconsIcon- icon={McpServerIcon}- className="size-4 text-foreground"- />- </div>- <div className="flex min-w-0 flex-1 flex-col gap-0.5">- <h2 className="settings-heading text-base font-semibold font-heading">- {t("settings.apiKeys.mcp.title")}- </h2>- <p className="text-xs text-muted-foreground leading-relaxed">- {t("settings.apiKeys.mcp.description")}- </p>- </div>- </div>-{error ? (- <p className="border-t border-border/60 px-4 py-2.5 text-xs leading-snug text-destructive">- {error}- </p>+ <p className="pt-2 text-xs leading-snug text-destructive">{error}</p>) : null}{settings ? (- <div className="border-t border-border/60 px-4 py-1">+ <><SettingsRow- label={t("settings.apiKeys.mcp.enable")}+ icon={+ <HugeiconsIcon+ icon={McpServerIcon}+ strokeWidth={1.75}+ className="size-[calc(18px*var(--ui-space-scale,1))]"+ />+ }+ label={t("settings.apiKeys.mcp.title")}+ hint={t("settings.apiKeys.mcp.enableDescription")}description={settings.forcedByEnv? t("settings.apiKeys.mcp.lockedByEnv", { name: ENV_FORCE })- : t("settings.apiKeys.mcp.enableDescription")+ : t("settings.apiKeys.mcp.description")}><Switch@@ -271,8 +260,8 @@ export function McpAccessSection({</div></>) : null}- </div>+ </>) : null}- </section>+ </div>);}diff --git a/studio/frontend/src/features/settings/components/media-api-examples.tsx b/studio/frontend/src/features/settings/components/media-api-examples.tsxindex 541d8a7fb74..c12470a74c5 100644--- a/studio/frontend/src/features/settings/components/media-api-examples.tsx+++ b/studio/frontend/src/features/settings/components/media-api-examples.tsx@@ -2,6 +2,7 @@// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0import { usePlatformStore } from "@/config/env";+import { useIsAccountOwner } from "@/features/auth";import { useT } from "@/i18n";import { isTauri } from "@/lib/api-base";import { Image01Icon } from "@hugeicons/core-free-icons";@@ -16,6 +17,7 @@ import {subscribeOpenAIAutoSwitchSettings,} from "../api/openai-auto-switch";import { useSettingsDialogStore } from "../stores/settings-dialog-store";+import { MediaAutoSwitchRow } from "./model-auto-switch-section";import { useSettingsPanelPrefsStore } from "../stores/settings-panel-prefs-store";import {ExampleCodeBox,@@ -46,8 +48,10 @@ export function MediaApiExamples({useTunnel,keylessScope = "off",keylessExposure = null,+ showHeading = true,}: {apiKey?: string | null;+ showHeading?: boolean;useTunnel: boolean;keylessScope?: KeylessApiAccessScope;keylessExposure?: KeylessApiAccessExposure | null;@@ -80,7 +84,8 @@ export function MediaApiExamples({}, [mediaApiRequested]);useEffect(() => {- if (scrollTarget !== "api-keys-media-api") return;+ // The API page's copy (no heading) must not answer, or the dialog's never scrolls.+ if (!showHeading || scrollTarget !== "api-keys-media-api") return;const section = sectionRef.current;if (!section) return;const pin = () => section.scrollIntoView({ block: "start" });@@ -102,7 +107,7 @@ export function MediaApiExamples({window.clearTimeout(timer);for (const name of events) window.removeEventListener(name, release);};- }, [scrollTarget]);+ }, [scrollTarget, showHeading]);useEffect(() => {let cancelled = false;@@ -151,6 +156,7 @@ export function MediaApiExamples({if (stored) setStoredLang(stored);};+ const isOwner = useIsAccountOwner();return (<sectionref={sectionRef}@@ -158,14 +164,21 @@ export function MediaApiExamples({className="flex min-w-0 max-w-full scroll-mt-6 flex-col gap-4"><div className="flex flex-col gap-1">- <h2 className="settings-heading flex items-center gap-2 text-base font-semibold font-heading">- <HugeiconsIcon icon={Image01Icon} strokeWidth={1.75} className="size-[calc(18px*var(--ui-space-scale,1))] shrink-0 text-muted-foreground" />- {t("settings.apiKeys.mediaApi.title")}- </h2>+ {showHeading && (+ <h2 className="settings-heading flex items-center gap-2 text-base font-semibold font-heading">+ <HugeiconsIcon icon={Image01Icon} strokeWidth={1.75} className="size-[calc(18px*var(--ui-space-scale,1))] shrink-0 text-muted-foreground" />+ {t("settings.apiKeys.mediaApi.title")}+ </h2>+ )}<p className="text-xs leading-relaxed text-muted-foreground">{t("settings.apiKeys.mediaApi.description")}</p></div>+ {isOwner ? (+ <div className="-my-3">+ <MediaAutoSwitchRow />+ </div>+ ) : null}<ExampleTogglelabel={t("settings.apiKeys.exampleKind")}variant="toggle"diff --git a/studio/frontend/src/features/settings/components/model-auto-switch-section.tsx b/studio/frontend/src/features/settings/components/model-auto-switch-section.tsxindex d213187c7fa..68b47e59f5f 100644--- a/studio/frontend/src/features/settings/components/model-auto-switch-section.tsx+++ b/studio/frontend/src/features/settings/components/model-auto-switch-section.tsx@@ -172,6 +172,76 @@ export function MediaIdleUnloadSetting({);}+// Also shown in the Images / Video API section; each copy reloads when the other saves.+const AUTO_SWITCH_UPDATED_EVENT = "unsloth-auto-switch-updated";++export function MediaAutoSwitchRow() {+ const t = useT();+ const [settings, setSettings] = useState<OpenAIAutoSwitchSettings | null>(+ null,+ );+ const [isSaving, setIsSaving] = useState(false);+ const [error, setError] = useState<string | null>(null);++ useEffect(() => {+ let cancelled = false;+ const load = () =>+ void loadOpenAIAutoSwitchSettings()+ .then((loaded) => {+ if (!cancelled) setSettings(loaded);+ })+ .catch(() => undefined);+ load();+ window.addEventListener(AUTO_SWITCH_UPDATED_EVENT, load);+ return () => {+ cancelled = true;+ window.removeEventListener(AUTO_SWITCH_UPDATED_EVENT, load);+ };+ }, []);++ const toggle = async (mediaAutoSwitchModel: boolean) => {+ if (!settings) return;+ setIsSaving(true);+ setError(null);+ try {+ setSettings(+ await updateOpenAIAutoSwitchSettings({+ enabled: settings.enabled,+ mediaAutoSwitchModel,+ }),+ );+ window.dispatchEvent(new Event(AUTO_SWITCH_UPDATED_EVENT));+ } catch (saveError) {+ setError(+ saveError instanceof Error+ ? saveError.message+ : t("settings.general.modelAutoSwitch.saveError"),+ );+ } finally {+ setIsSaving(false);+ }+ };++ return (+ <SettingsRow+ label={t("settings.general.modelAutoSwitch.mediaEnable")}+ description={t("settings.general.modelAutoSwitch.mediaEnableDescription")}+ below={+ error ? (+ <span className="text-right text-xs text-destructive">{error}</span>+ ) : null+ }+ >+ <Switch+ checked={settings?.mediaAutoSwitchModel ?? false}+ disabled={!settings || isSaving}+ onCheckedChange={(on) => void toggle(on)}+ aria-label={t("settings.general.modelAutoSwitch.mediaEnable")}+ />+ </SettingsRow>+ );+}+export function ModelAutoSwitchSection() {const t = useT();const [settings, setSettings] = useState<OpenAIAutoSwitchSettings | null>(@@ -198,8 +268,16 @@ export function ModelAutoSwitchSection() {: t("settings.general.modelAutoSwitch.loadError"),);});+ const reload = () =>+ void loadOpenAIAutoSwitchSettings()+ .then((loaded) => {+ if (!cancelled) setSettings(loaded);+ })+ .catch(() => undefined);+ window.addEventListener(AUTO_SWITCH_UPDATED_EVENT, reload);return () => {cancelled = true;+ window.removeEventListener(AUTO_SWITCH_UPDATED_EVENT, reload);};}, [t]);@@ -214,6 +292,7 @@ export function ModelAutoSwitchSection() {try {const saved = await updateOpenAIAutoSwitchSettings(update);setSettings(saved);+ window.dispatchEvent(new Event(AUTO_SWITCH_UPDATED_EVENT));if (syncDraft) {setDraftIdleSeconds(String(saved.autoUnloadIdleSeconds));}diff --git a/studio/frontend/src/features/settings/components/model-memory-section.tsx b/studio/frontend/src/features/settings/components/model-memory-section.tsxindex 95c3ff35d3a..b176f73267c 100644--- a/studio/frontend/src/features/settings/components/model-memory-section.tsx+++ b/studio/frontend/src/features/settings/components/model-memory-section.tsx@@ -8,7 +8,6 @@ import {SelectTrigger,SelectValue,} from "@/components/ui/select";-import { Button } from "@/components/ui/button";import { Switch } from "@/components/ui/switch";import {resyncInferenceStatusAfterKeptModelsUnload,@@ -217,10 +216,9 @@ export function ModelMemorySection({ref={ref}action={full ? undefined : (- <Button- size="sm"- variant="ghost"- className="text-muted-foreground"+ <button+ type="button"+ 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"onClick={() =>useSettingsDialogStore.getState()@@ -228,8 +226,8 @@ export function ModelMemorySection({}>{t("settings.resources.modelMemory.openSystemSettings")}- <HugeiconsIcon icon={ChevronRightStandardIcon} className="size-3.5" />- </Button>+ <HugeiconsIcon icon={ChevronRightStandardIcon} className="size-3" />+ </button>)}>diff --git a/studio/frontend/src/features/settings/components/monitor-link.tsx b/studio/frontend/src/features/settings/components/monitor-link.tsxindex 5f9cdc05367..8b324713e4c 100644--- a/studio/frontend/src/features/settings/components/monitor-link.tsx+++ b/studio/frontend/src/features/settings/components/monitor-link.tsx@@ -7,16 +7,14 @@ 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 {- ActivityIcon,-} from "@hugeicons/core-free-icons";-import {- ArrowRightIcon,-} from "lucide-react";+import { ActivityIcon } from "@hugeicons/core-free-icons";+import { ArrowRightIcon } from "lucide-react";import { HugeiconsIcon } from "@hugeicons/react";import { useNavigate } from "@tanstack/react-router";import { type ReactElement, useEffect, useState } from "react";import { useSettingsDialogStore } from "../stores/settings-dialog-store";+import { SettingsRow } from "./settings-row";+import { SettingsSection } from "./settings-section";export function MonitorLink(): ReactElement {const navigate = useNavigate();@@ -42,63 +40,60 @@ export function MonitorLink(): ReactElement {const recent = data?.entries.length ?? 0;return (- <div className="flex flex-col gap-2">- <button- type="button"- onClick={() => {- useSettingsDialogStore.getState().closeDialog();- void navigate({ to: "/api-monitor" });- }}- className="flex w-full min-w-0 items-center gap-3 rounded-lg border border-border/70 bg-background px-4 py-3 text-left transition-colors hover:bg-muted/40 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"- >- <span className="relative flex size-8 shrink-0 items-center justify-center icon-disc">- <HugeiconsIcon- icon={ActivityIcon}- strokeWidth={1.75}- className="size-4"- />- {active > 0 ? (- <span className="absolute right-1 top-1 size-2 rounded-full bg-emerald-500" />- ) : null}- </span>- <span className="flex min-w-0 flex-col">- <span className="text-sm font-semibold text-foreground">- {t("settings.resources.liveMonitor.apiTitle")}+ <SettingsSection title={t("settings.resources.liveMonitor.apiTitle")}>+ <div className="flex flex-col pt-3">+ <button+ type="button"+ onClick={() => {+ useSettingsDialogStore.getState().closeDialog();+ void navigate({ to: "/api-monitor" });+ }}+ className="flex w-full min-w-0 items-center gap-3 rounded-lg border border-border/70 bg-background px-4 py-3 text-left transition-colors hover:bg-muted/40 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"+ >+ <span className="relative flex size-8 shrink-0 items-center justify-center icon-disc">+ <HugeiconsIcon+ icon={ActivityIcon}+ strokeWidth={1.75}+ className="size-4"+ />+ {active > 0 ? (+ <span className="absolute right-1 top-1 size-2 rounded-full bg-emerald-500" />+ ) : null}</span>- <span className="truncate text-xs text-muted-foreground">- {data == null- ? t("settings.resources.liveMonitor.summary")- : t("settings.resources.liveMonitor.status", {- active: active.toLocaleString(locale),- recent: recent.toLocaleString(locale),- model:- data.active_model ??- t("settings.resources.liveMonitor.noModelLoaded"),- })}+ <span className="flex min-w-0 flex-col">+ <span className="truncate text-sm font-semibold text-foreground">+ {t("settings.resources.liveMonitor.summary")}+ </span>+ <span className="min-h-[1lh] truncate text-xs text-muted-foreground">+ {data == null+ ? null+ : t("settings.resources.liveMonitor.status", {+ active: active.toLocaleString(locale),+ recent: recent.toLocaleString(locale),+ model:+ data.active_model ??+ t("settings.resources.liveMonitor.noModelLoaded"),+ })}+ </span></span>- </span>- <ArrowRightIcon- strokeWidth={1.75}- className="ml-auto size-4 shrink-0 text-muted-foreground"- />- </button>+ <ArrowRightIcon+ strokeWidth={1.75}+ className="ml-auto size-4 shrink-0 text-muted-foreground"+ />+ </button>- {/* Where the panel's own "stop opening this" gets turned back on. */}- <div className="flex items-center justify-between gap-3 rounded-md px-1 py-1">- <span className="flex min-w-0 flex-col">- <span className="text-sm text-foreground">- {t("settings.resources.liveMonitor.autoOpen")}- </span>- <span className="text-xs text-muted-foreground">- {t("settings.resources.liveMonitor.autoOpenDescription")}- </span>- </span>- <Switch- checked={autoOpen}- onCheckedChange={setAutoOpen}- aria-label={t("settings.resources.liveMonitor.autoOpen")}- />+ {/* Where the panel's own "stop opening this" gets turned back on. */}+ <SettingsRow+ label={t("settings.resources.liveMonitor.autoOpen")}+ description={t("settings.resources.liveMonitor.autoOpenDescription")}+ >+ <Switch+ checked={autoOpen}+ onCheckedChange={setAutoOpen}+ aria-label={t("settings.resources.liveMonitor.autoOpen")}+ />+ </SettingsRow></div>- </div>+ </SettingsSection>);}diff --git a/studio/frontend/src/features/settings/components/recent-dictations-view.tsx b/studio/frontend/src/features/settings/components/recent-dictations-view.tsxindex ab215d19d06..c31ba5d138c 100644--- a/studio/frontend/src/features/settings/components/recent-dictations-view.tsx+++ b/studio/frontend/src/features/settings/components/recent-dictations-view.tsx@@ -36,11 +36,11 @@ import { useT } from "@/i18n";import { copyToClipboard } from "@/lib/copy-to-clipboard";import { toast } from "@/lib/toast";import {- Copy01Icon,Delete02Icon,Search01Icon,ViewIcon,} from "@hugeicons/core-free-icons";+import { Copy01Icon } from "@/lib/copy-icon";import { MessageCircleIcon } from "@/lib/hugeicons-derived";import { HugeiconsIcon } from "@hugeicons/react";import { useNavigate } from "@tanstack/react-router";diff --git a/studio/frontend/src/features/settings/components/update-studio-instructions.tsx b/studio/frontend/src/features/settings/components/update-studio-instructions.tsxindex f41c8be5aae..849299c4496 100644--- a/studio/frontend/src/features/settings/components/update-studio-instructions.tsx+++ b/studio/frontend/src/features/settings/components/update-studio-instructions.tsx@@ -8,8 +8,8 @@ import { Tick02Icon } from "@/lib/tick-icon";import { cn } from "@/lib/utils";import {ArrowUpRight01Icon,- Copy01Icon,} from "@hugeicons/core-free-icons";+import { Copy01Icon } from "@/lib/copy-icon";import { HugeiconsIcon } from "@hugeicons/react";import { AnimatePresence, motion, useReducedMotion } from "motion/react";import type { ReactElement } from "react";diff --git a/studio/frontend/src/features/settings/components/url-pill.tsx b/studio/frontend/src/features/settings/components/url-pill.tsxindex d2d682d7bf6..e005ab8411b 100644--- a/studio/frontend/src/features/settings/components/url-pill.tsx+++ b/studio/frontend/src/features/settings/components/url-pill.tsx@@ -5,7 +5,7 @@ import { LineBox } from "@/components/ui/line-box";import { copyToClipboard } from "@/lib/copy-to-clipboard";import { cn } from "@/lib/utils";import { Tick02Icon } from "@/lib/tick-icon";-import { Copy01Icon } from "@hugeicons/core-free-icons";+import { Copy01Icon } from "@/lib/copy-icon";import { HugeiconsIcon } from "@hugeicons/react";import { useEffect, useRef, useState } from "react";diff --git a/studio/frontend/src/features/settings/components/usage-examples.tsx b/studio/frontend/src/features/settings/components/usage-examples.tsxindex 2078869ca03..87daacbf53c 100644--- a/studio/frontend/src/features/settings/components/usage-examples.tsx+++ b/studio/frontend/src/features/settings/components/usage-examples.tsx@@ -28,17 +28,21 @@ import { useT } from "@/i18n";import type { TranslationKey } from "@/i18n";import { 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 {ArrowUpRight01Icon,BotIcon,- Copy01Icon,+ Image01Icon,InformationCircleIcon,- SourceCodeIcon,+ McpServerIcon,+ TaskDone01Icon,} from "@hugeicons/core-free-icons";+import { Copy01Icon } from "@/lib/copy-icon";import { HugeiconsIcon } from "@hugeicons/react";import {+ type ReactNode,useEffect,useMemo,useRef,@@ -52,6 +56,7 @@ import type {} from "../api/keyless-api-access";import { loadOpenAIAutoSwitchSettings } from "../api/openai-auto-switch";import { type OpenAIModel, listOpenAIModels } from "../api/openai-models";+import { scrollIntoPane } from "../lib/scroll-into-pane";import { useSettingsDialogStore } from "../stores/settings-dialog-store";import { useSettingsPanelPrefsStore } from "../stores/settings-panel-prefs-store";import {@@ -516,8 +521,12 @@ export function UsageExamples({keylessScope = "off",keylessTools = false,keylessExposure = null,+ agentsExtra = null,+ agentsOnly = false,}: {apiKey?: string | null;+ agentsOnly?: boolean;+ agentsExtra?: ReactNode;useTunnel: boolean;onUseTunnelChange: (next: boolean) => void;/** which routes keyless api access serves, so a placeholder is only used where it works */@@ -528,6 +537,34 @@ export function UsageExamples({}) {const t = useT();const isOwner = useIsAccountOwner();+ const scrollTarget = useSettingsDialogStore((s) => s.scrollTarget);+ // Refs, not ids: the API page can mount a second copy, and an id lookup found that one.+ const agentsRef = useRef<HTMLDivElement | null>(null);+ const mcpRef = useRef<HTMLDivElement | null>(null);+ useEffect(() => {+ if (agentsOnly) return;+ if (scrollTarget !== "api-keys-agents" && scrollTarget !== "api-keys-mcp") return;+ const target = scrollTarget;+ const section = (target === "api-keys-agents" ? agentsRef : mcpRef).current;+ if (!section) return;+ const pin = () => scrollIntoPane(section);+ const observer = new ResizeObserver(pin);+ observer.observe(section.parentElement ?? section);+ 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);+ };+ }, [scrollTarget, agentsOnly]);const cloudflareUrl = usePlatformStore((s) => s.cloudflareUrl);const serverUrl = usePlatformStore((s) => s.serverUrl);const secure = usePlatformStore((s) => s.secure);@@ -799,106 +836,114 @@ export function UsageExamples({return (<section className="flex min-w-0 max-w-full flex-col gap-4">- <h2 className="settings-heading flex items-center gap-2 text-base font-semibold font-heading">- <HugeiconsIcon icon={SourceCodeIcon} strokeWidth={1.75} className="size-[calc(18px*var(--ui-space-scale,1))] shrink-0 text-muted-foreground" />- {t("settings.apiKeys.usageExamples")}- </h2>- {/* 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">- <div className="flex shrink-0 items-center gap-1.5">- <Switch- size="sm"- checked={useTunnel}- onCheckedChange={onUseTunnelChange}- aria-label={t("settings.apiKeys.secureHttps")}- />- <span className="text-ui-11 font-medium text-foreground">- {t("settings.apiKeys.secureHttps")}- {/* Only for a network bind not launched with --secure: its raw port stays- reachable. A loopback bind (the default, and Desktop) exposes nothing. */}- {secure || loopbackBind ? null : (- <Tooltip>- <TooltipTrigger asChild={true}>- {/* Inline on the baseline, like a glyph after the label. */}- <button- type="button"- className="ml-1.5 inline-flex align-baseline rounded-full text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"- aria-label={t("settings.apiKeys.secureHttpsHint")}- >- {/* Follows the UI font size, like the SettingsRow hint- this matches. */}- <HugeiconsIcon- icon={InformationCircleIcon}- className="size-[var(--ui-icon-size-hint)]"- />- </button>- </TooltipTrigger>- <TooltipContent className="max-w-[calc(260px*var(--ui-space-scale,1))] text-ui-11 leading-snug">- {t("settings.apiKeys.secureHttpsHint")}- </TooltipContent>- </Tooltip>- )}- </span>- </div>- <button- type="button"- onClick={handleCopyUrl}- className={cn(- "flex min-w-0 items-center gap-1 rounded-full px-1.5 py-1 text-ui-11 text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",- !useTunnel && "opacity-50",- )}- title={cloudflareUrl}- aria-label={t("settings.apiKeys.copyTunnelUrl")}- >- <span className="truncate font-mono">{cloudflareUrl}</span>- <HugeiconsIcon- icon={copiedUrl ? Tick02Icon : Copy01Icon}- className={cn(- "size-3.5 shrink-0",- copiedUrl && "text-emerald-600",- )}- />- </button>- </div>- ) : null}- <ExampleToggle- label={t("settings.apiKeys.exampleRequest")}- variant="toggle"- value={variant}- options={VARIANTS.map((option) => ({- id: option.id,- label: t(option.labelKey),- }))}- onChange={(next) => pickExample(exampleType(language, next))}- />- {model ? null : (- <p className="text-ui-11 leading-relaxed text-muted-foreground">- {t("settings.apiKeys.usageNoModel")}- </p>- )}- <ExampleCodeBox- code={snippets[lang]}- language={shikiLang}- label={t("settings.apiKeys.usageExamples")}- redactFromReload={Boolean(apiKey)}- pills={+ {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>+ {/* 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">+ <div className="flex shrink-0 items-center gap-1.5">+ <Switch+ size="sm"+ checked={useTunnel}+ onCheckedChange={onUseTunnelChange}+ aria-label={t("settings.apiKeys.secureHttps")}+ />+ <span className="text-ui-11 font-medium text-foreground">+ {t("settings.apiKeys.secureHttps")}+ {/* Only for a network bind not launched with --secure: its raw port stays+ reachable. A loopback bind (the default, and Desktop) exposes nothing. */}+ {secure || loopbackBind ? null : (+ <Tooltip>+ <TooltipTrigger asChild={true}>+ {/* Inline on the baseline, like a glyph after the label. */}+ <button+ type="button"+ className="ml-1.5 inline-flex align-baseline rounded-full text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"+ aria-label={t("settings.apiKeys.secureHttpsHint")}+ >+ {/* Follows the UI font size, like the SettingsRow hint+ this matches. */}+ <HugeiconsIcon+ icon={InformationCircleIcon}+ className="size-[var(--ui-icon-size-hint)]"+ />+ </button>+ </TooltipTrigger>+ <TooltipContent className="max-w-[calc(260px*var(--ui-space-scale,1))] text-ui-11 leading-snug">+ {t("settings.apiKeys.secureHttpsHint")}+ </TooltipContent>+ </Tooltip>+ )}+ </span>+ </div>+ <button+ type="button"+ onClick={handleCopyUrl}+ className={cn(+ "flex min-w-0 items-center gap-1 rounded-full px-1.5 py-1 text-ui-11 text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",+ !useTunnel && "opacity-50",+ )}+ title={cloudflareUrl}+ aria-label={t("settings.apiKeys.copyTunnelUrl")}+ >+ <span className="truncate font-mono">{cloudflareUrl}</span>+ <HugeiconsIcon+ icon={copiedUrl ? Tick02Icon : Copy01Icon}+ className={cn(+ "size-3.5 shrink-0",+ copiedUrl && "text-emerald-600",+ )}+ />+ </button>+ </div>+ ) : null}<ExampleToggle- label={t("settings.apiKeys.exampleLanguage")}- value={language}- options={LANGUAGES}- onChange={(next) => pickExample(exampleType(next, variant))}+ label={t("settings.apiKeys.exampleRequest")}+ variant="toggle"+ value={variant}+ options={VARIANTS.map((option) => ({+ id: option.id,+ label: t(option.labelKey),+ }))}+ onChange={(next) => pickExample(exampleType(language, next))}/>- }- os={os}- onOsChange={setOs}- />- <div className="flex min-w-0 flex-col gap-2.5 pt-2">+ {model ? null : (+ <p className="text-ui-11 leading-relaxed text-muted-foreground">+ {t("settings.apiKeys.usageNoModel")}+ </p>+ )}+ <ExampleCodeBox+ code={snippets[lang]}+ language={shikiLang}+ label={t("settings.apiKeys.usageExamples")}+ redactFromReload={Boolean(apiKey)}+ pills={+ <ExampleToggle+ label={t("settings.apiKeys.exampleLanguage")}+ value={language}+ options={LANGUAGES}+ onChange={(next) => pickExample(exampleType(next, variant))}+ />+ }+ os={os}+ onOsChange={setOs}+ />+ </>+ )}+ <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">- <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.apiKeys.codingAgents")}- </h2>+ {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 landon General, so they get the agent's docs instead. The tab restores its agentfrom this pref when it mounts. */}@@ -907,7 +952,9 @@ export function UsageExamples({type="button"onClick={() => {setAgentsTabAgent(agent);- useSettingsDialogStore.getState().setActiveTab("agents");+ // 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">@@ -1005,6 +1052,7 @@ export function UsageExamples({{t("settings.agents.vscodeNote")}</p>)}+ {agentsExtra ? <div ref={mcpRef}>{agentsExtra}</div> : null}</div></section>);diff --git a/studio/frontend/src/features/settings/lib/scroll-into-pane.ts b/studio/frontend/src/features/settings/lib/scroll-into-pane.tsnew file mode 100644index 00000000000..f69f018a5a8--- /dev/null+++ b/studio/frontend/src/features/settings/lib/scroll-into-pane.ts@@ -0,0 +1,22 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++// scrollIntoView also scrolls overflow-hidden ancestors, shifting the whole dialog; this scrolls the pane.+export function scrollIntoPane(el: HTMLElement, offset = 24): void {+ let pane = el.parentElement;+ while (pane) {+ const overflowY = getComputedStyle(pane).overflowY;+ if (overflowY === "auto" || overflowY === "scroll") break;+ pane = pane.parentElement;+ }+ if (!pane) {+ el.scrollIntoView({ block: "start", behavior: "smooth" });+ return;+ }+ const top =+ el.getBoundingClientRect().top -+ pane.getBoundingClientRect().top ++ pane.scrollTop -+ offset;+ pane.scrollTo({ top, behavior: "smooth" });+}diff --git a/studio/frontend/src/features/settings/stores/settings-dialog-store.ts b/studio/frontend/src/features/settings/stores/settings-dialog-store.tsindex 5e8e40b3d35..45f9ada495c 100644--- a/studio/frontend/src/features/settings/stores/settings-dialog-store.ts+++ b/studio/frontend/src/features/settings/stores/settings-dialog-store.ts@@ -32,6 +32,8 @@ export type SettingsScrollTarget =| "api-keys-audio-api"| "api-keys-media-api"| "api-keys-decision-api"+ | "api-keys-agents"+ | "api-keys-mcp"| "appearance-sidebar-nav"| "chat-composer"| "browser-html-network"@@ -40,6 +42,7 @@ export type SettingsScrollTarget =/** Old name of sandbox-permissions, from when Permissions lived in General. */| "general-permissions"| "library-storage"+ | "remote-lan-keyless"| "resources-caches"| "resources-model-memory"| "sandbox-os"@@ -165,12 +168,15 @@ const SCROLL_TARGET_TAB: Record<SettingsScrollTarget, SettingsTab> = {"api-keys-audio-api": "api-keys","api-keys-media-api": "api-keys","api-keys-decision-api": "api-keys",+ "api-keys-agents": "api-keys",+ "api-keys-mcp": "api-keys","appearance-sidebar-nav": "appearance","browser-html-network": "browser","general-hub": "general","general-rag-embedding": "general","general-permissions": "sandbox","library-storage": "library",+ "remote-lan-keyless": "remote-lan","resources-caches": "resources","resources-model-memory": "resources","sandbox-os": "sandbox",diff --git a/studio/frontend/src/features/settings/tabs/accounts-tab.tsx b/studio/frontend/src/features/settings/tabs/accounts-tab.tsxindex f6230e870ae..1517604aaab 100644--- a/studio/frontend/src/features/settings/tabs/accounts-tab.tsx+++ b/studio/frontend/src/features/settings/tabs/accounts-tab.tsx@@ -4,7 +4,6 @@import { useEffect, useRef, useState, type SyntheticEvent } from "react";import {Add01Icon,- Copy01Icon,CubeIcon,Delete02Icon,Key01Icon,@@ -14,6 +13,7 @@ import {UserBlock01Icon,UserCheck01Icon,} from "@hugeicons/core-free-icons";+import { Copy01Icon } from "@/lib/copy-icon";import { HugeiconsIcon } from "@hugeicons/react";import { Tick02Icon } from "@/lib/tick-icon";import { cn } from "@/lib/utils";diff --git a/studio/frontend/src/features/settings/tabs/agents-tab.tsx b/studio/frontend/src/features/settings/tabs/agents-tab.tsxindex 56fa29375ff..339f74f0137 100644--- a/studio/frontend/src/features/settings/tabs/agents-tab.tsx+++ b/studio/frontend/src/features/settings/tabs/agents-tab.tsx@@ -49,7 +49,8 @@ import { getApiBase, isTauri } from "@/lib/api-base";import { ChevronDownStandardIcon } from "@/lib/chevron-icons";import { Tick02Icon } from "@/lib/tick-icon";import { cn } from "@/lib/utils";-import { ArrowUpRight01Icon, Copy01Icon } from "@hugeicons/core-free-icons";+import { ArrowUpRight01Icon } from "@hugeicons/core-free-icons";+import { Copy01Icon } from "@/lib/copy-icon";import { HugeiconsIcon } from "@hugeicons/react";import {useCallback,diff --git a/studio/frontend/src/features/settings/tabs/api-keys-tab.tsx b/studio/frontend/src/features/settings/tabs/api-keys-tab.tsxindex 1e09292c819..cd1e011ec00 100644--- a/studio/frontend/src/features/settings/tabs/api-keys-tab.tsx+++ b/studio/frontend/src/features/settings/tabs/api-keys-tab.tsx@@ -10,6 +10,7 @@ import {DialogHeader,DialogTitle,} from "@/components/ui/dialog";+import { usePlatformStore } from "@/config/env";import { useIsAccountOwner } from "@/features/auth";import { cn } from "@/lib/utils";import { translate, useT } from "@/i18n";@@ -21,9 +22,10 @@ import {fetchApiKeys,revokeApiKey,} from "../api/api-keys";-import type {- KeylessApiAccessExposure,- KeylessApiAccessScope,+import {+ type KeylessApiAccessExposure,+ type KeylessApiAccessScope,+ loadKeylessApiAccess,} from "../api/keyless-api-access";import { apiKeyActionMessage } from "../components/api-key-action-message";import {@@ -36,7 +38,8 @@ 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 { KeylessApiAccessSection } from "../components/keyless-api-access-section";+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";@@ -71,6 +74,29 @@ export function ApiKeysTab() {tools: boolean;exposure: KeylessApiAccessExposure | null;}>({ scope: "off", tools: false, exposure: null });+ // Read for the examples' placeholder key; a tunnel coming or going changes exposure.+ const cloudflareUrl = usePlatformStore((state) => state.cloudflareUrl);+ // biome-ignore lint/correctness/useExhaustiveDependencies: cloudflareUrl is a trigger, not an input+ useEffect(() => {+ if (!isOwner) {+ return;+ }+ let cancelled = false;+ loadKeylessApiAccess()+ .then((next) => {+ if (!cancelled) {+ setKeyless({+ scope: next.suspendedByAccounts ? "off" : next.scope,+ tools: next.tools,+ exposure: next.exposure,+ });+ }+ })+ .catch(() => undefined);+ return () => {+ cancelled = true;+ };+ }, [isOwner, cloudflareUrl]);const reduced = useReducedMotion();const transition = reduced? { duration: 0 }@@ -166,84 +192,91 @@ export function ApiKeysTab() {</p></header>- <AnimatePresence mode="wait" initial={false}>- {revealed !== null ? (- <motion.div- key="reveal"- initial={{ opacity: 0, y: -4 }}- animate={{ opacity: 1, y: 0 }}- exit={{ opacity: 0, y: -4 }}- transition={transition}- >- <KeyRevealCard rawKey={revealed} onDone={() => setRevealed(null)} />- </motion.div>- ) : (- <motion.div- key="form"- initial={{ opacity: 0, y: 4 }}- animate={{ opacity: 1, y: 0 }}- exit={{ opacity: 0, y: 4 }}- transition={transition}- >- <CreateKeyForm- onCreated={(raw) => {- setRevealed(raw);- void load();- }}- onError={setActionError}- existingNames={keys.map((k) => k.name)}- />- </motion.div>- )}- </AnimatePresence>+ <ApiJumpLinks />- <section className="flex min-w-0 flex-col">- <h2 className="settings-heading mb-2 text-sm font-semibold">+ <section className="flex min-w-0 flex-col gap-4">+ <h2 className="settings-heading text-base font-semibold font-heading">{t("settings.apiKeys.accessTokens")}</h2>- {actionError ? (- <div className="mb-2 rounded-lg border border-destructive/20 bg-destructive/5 p-3 text-xs text-destructive">- {actionError}- </div>- ) : null}- {error ? (- <div className="rounded-lg border border-destructive/20 bg-destructive/5 p-3 text-xs text-destructive">- {error}- </div>- ) : loading ? (- <div className="flex flex-col gap-2 py-2">- {[0, 1].map((i) => (- <div- key={i}- className="h-12 animate-pulse rounded-md bg-muted/40"+ <AnimatePresence mode="wait" initial={false}>+ {revealed !== null ? (+ <motion.div+ key="reveal"+ initial={{ opacity: 0, y: -4 }}+ animate={{ opacity: 1, y: 0 }}+ exit={{ opacity: 0, y: -4 }}+ transition={transition}+ >+ <KeyRevealCard+ rawKey={revealed}+ onDone={() => setRevealed(null)}/>- ))}- </div>- ) : keys.length === 0 ? (- <p className="py-6 text-center text-xs text-muted-foreground">- {t("settings.apiKeys.noAccess")}- </p>- ) : (- <div className="hover-scrollbar flex max-h-72 min-w-0 flex-col overflow-y-auto pr-1 [scrollbar-gutter:stable]">- <div className={cn("overlay-scrollbar-gutter", TOKEN_TABLE)}>- <ApiKeyTableHeader />- {keys.map((k) => (- <ApiKeyRow- key={k.id}- apiKey={k}- onRevoke={(key) => {- setRegenerate(false);- setRevokeTarget(key);- }}- onRegenerate={(key) => {- setRegenerate(true);- setRevokeTarget(key);- }}+ </motion.div>+ ) : (+ <motion.div+ key="form"+ initial={{ opacity: 0, y: 4 }}+ animate={{ opacity: 1, y: 0 }}+ exit={{ opacity: 0, y: 4 }}+ transition={transition}+ >+ <CreateKeyForm+ onCreated={(raw) => {+ setRevealed(raw);+ void load();+ }}+ onError={setActionError}+ existingNames={keys.map((k) => k.name)}+ />+ </motion.div>+ )}+ </AnimatePresence>++ <div className="flex min-w-0 flex-col">+ {actionError ? (+ <div className="mb-2 rounded-lg border border-destructive/20 bg-destructive/5 p-3 text-xs text-destructive">+ {actionError}+ </div>+ ) : null}+ {error ? (+ <div className="rounded-lg border border-destructive/20 bg-destructive/5 p-3 text-xs text-destructive">+ {error}+ </div>+ ) : loading ? (+ <div className="flex flex-col gap-2 py-2">+ {[0, 1].map((i) => (+ <div+ key={i}+ className="h-12 animate-pulse rounded-md bg-muted/40"/>))}</div>- </div>- )}+ ) : keys.length === 0 ? (+ <p className="py-6 text-center text-xs text-muted-foreground">+ {t("settings.apiKeys.noAccess")}+ </p>+ ) : (+ <div className="hover-scrollbar flex max-h-72 min-w-0 flex-col overflow-y-auto pr-1 [scrollbar-gutter:stable]">+ <div className={cn("overlay-scrollbar-gutter", TOKEN_TABLE)}>+ <ApiKeyTableHeader />+ {keys.map((k) => (+ <ApiKeyRow+ key={k.id}+ apiKey={k}+ onRevoke={(key) => {+ setRegenerate(false);+ setRevokeTarget(key);+ }}+ onRegenerate={(key) => {+ setRegenerate(true);+ setRevokeTarget(key);+ }}+ />+ ))}+ </div>+ </div>+ )}+ </div></section><UsageExamples@@ -253,16 +286,11 @@ export function ApiKeysTab() {keylessScope={keyless.scope}keylessTools={keyless.tools}keylessExposure={keyless.exposure}+ // Installation-wide, so owner-only routes.+ agentsExtra={isOwner ? <McpAccessSection apiKey={revealed} /> : null}/>- {/* Installation-wide controls: owner-only routes. */}- {isOwner ? (- <>- <KeylessApiAccessSection onSettingsChange={setKeyless} />-- <McpAccessSection apiKey={revealed} />- </>- ) : null}+ {isOwner ? <KeylessApiAccessLink /> : null}<MonitorLink />@@ -276,14 +304,14 @@ export function ApiKeysTab() {</>) : null}- <AudioApiExamples+ <MediaApiExamplesapiKey={revealed}useTunnel={useTunnel}keylessScope={keyless.scope}keylessExposure={keyless.exposure}/>- <MediaApiExamples+ <AudioApiExamplesapiKey={revealed}useTunnel={useTunnel}keylessScope={keyless.scope}diff --git a/studio/frontend/src/features/settings/tabs/data-tab.tsx b/studio/frontend/src/features/settings/tabs/data-tab.tsxindex ae27b9458fa..d88107da194 100644--- a/studio/frontend/src/features/settings/tabs/data-tab.tsx+++ b/studio/frontend/src/features/settings/tabs/data-tab.tsx@@ -77,7 +77,7 @@ import {import { isDownloadCancelled, pickNativeChatImport } from "@/lib/native-files";import { toast } from "@/lib/toast";import {- Archive02Icon,+ Archive03Icon,Delete02Icon,Download01Icon,FlimSlateIcon,@@ -867,12 +867,11 @@ export function DataTab({ searchEntry }: { searchEntry?: string }) {><Buttonvariant="outline"- size="icon"- aria-label={t("settings.data.archiveAllAction")}- title={t("settings.data.archiveAllAction")}+ size="sm"onClick={() => setArchiveConfirmOpen(true)}>- <HugeiconsIcon icon={Archive02Icon} className="size-4" />+ <HugeiconsIcon icon={Archive03Icon} data-icon="inline-start" />+ {t("settings.data.archiveAllAction")}</Button></SettingsRow></SettingsSection>diff --git a/studio/frontend/src/features/settings/tabs/debugging-tab.tsx b/studio/frontend/src/features/settings/tabs/debugging-tab.tsxindex 27b99216554..37c18c78b52 100644--- a/studio/frontend/src/features/settings/tabs/debugging-tab.tsx+++ b/studio/frontend/src/features/settings/tabs/debugging-tab.tsx@@ -31,7 +31,6 @@ import { toast } from "@/lib/toast";import { cn } from "@/lib/utils";import {Alert02Icon,- Copy01Icon,Download01Icon,FolderOpenIcon,InformationCircleIcon,@@ -40,6 +39,7 @@ import {Shield01Icon,TextWrapIcon,} from "@hugeicons/core-free-icons";+import { Copy01Icon } from "@/lib/copy-icon";import { HugeiconsIcon } from "@hugeicons/react";import { ArrowDownIcon } from "lucide-react";import {diff --git a/studio/frontend/src/features/settings/tabs/general-tab.tsx b/studio/frontend/src/features/settings/tabs/general-tab.tsxindex 7b462c8f7e8..fbe09cb4d3c 100644--- a/studio/frontend/src/features/settings/tabs/general-tab.tsx+++ b/studio/frontend/src/features/settings/tabs/general-tab.tsx@@ -699,7 +699,6 @@ export function GeneralTab() {/></SettingsRow><SettingsRow- destructive={true}label={t("settings.general.previewSharing.revokeLabel")}description={t("settings.general.previewSharing.revokeDescription")}>diff --git a/studio/frontend/src/features/settings/tabs/remote-lan-tab.tsx b/studio/frontend/src/features/settings/tabs/remote-lan-tab.tsxindex 5ef16bf72ff..e08dc7abe96 100644--- a/studio/frontend/src/features/settings/tabs/remote-lan-tab.tsx+++ b/studio/frontend/src/features/settings/tabs/remote-lan-tab.tsx@@ -2,12 +2,36 @@// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0import { useT } from "@/i18n";+import { useEffect, useRef } from "react";import { KeylessApiAccessSection } from "../components/keyless-api-access-section";import { LanAccessSection } from "../components/lan-access-section";import { RemoteAccessSection } from "../components/remote-access-section";+import { scrollIntoPane } from "../lib/scroll-into-pane";+import { useSettingsDialogStore } from "../stores/settings-dialog-store";export function RemoteLanTab() {const t = useT();+ const keylessRef = useRef<HTMLDivElement>(null);+ const scrollTarget = useSettingsDialogStore((s) => s.scrollTarget);+ const consumeScrollTarget = useSettingsDialogStore((s) => s.consumeScrollTarget);++ // Again once the sections above have loaded: their rows arrive late and push it back down.+ useEffect(() => {+ if (scrollTarget !== "remote-lan-keyless") return;+ const land = () => {+ if (keylessRef.current) scrollIntoPane(keylessRef.current);+ };+ const frame = window.requestAnimationFrame(land);+ // Consumed here, not on the first frame: clearing the target re-runs this effect and its cleanup.+ const settle = window.setTimeout(() => {+ land();+ consumeScrollTarget("remote-lan-keyless");+ }, 600);+ return () => {+ window.cancelAnimationFrame(frame);+ window.clearTimeout(settle);+ };+ }, [consumeScrollTarget, scrollTarget]);return (<div className="settings-page">@@ -30,7 +54,9 @@ export function RemoteLanTab() {<LanAccessSection />- <KeylessApiAccessSection />+ <div ref={keylessRef}>+ <KeylessApiAccessSection />+ </div></div>);}diff --git a/studio/frontend/src/features/settings/tabs/voice-tab.tsx b/studio/frontend/src/features/settings/tabs/voice-tab.tsxindex 9a2c68d6cf9..2ce848cd3d0 100644--- a/studio/frontend/src/features/settings/tabs/voice-tab.tsx+++ b/studio/frontend/src/features/settings/tabs/voice-tab.tsx@@ -63,8 +63,8 @@ import { MicIcon } from "@/lib/mic-icon";import { toast } from "@/lib/toast";import {Search01Icon,- StopIcon,} from "@hugeicons/core-free-icons";+import { StopIcon } from "@/lib/media-control-icons";import { AiSpeechIcon } from "@/lib/hugeicons-derived";import { Volume02Icon } from "@/lib/volume-icons";import { HugeiconsIcon } from "@hugeicons/react";diff --git a/studio/frontend/src/features/studio/sections/progress-section.tsx b/studio/frontend/src/features/studio/sections/progress-section.tsxindex 40013840ce9..d301258b588 100644--- a/studio/frontend/src/features/studio/sections/progress-section.tsx+++ b/studio/frontend/src/features/studio/sections/progress-section.tsx@@ -47,11 +47,11 @@ import {FolderExportIcon,Notebook01Icon,RamMemoryIcon,- StopIcon,TaskDone01Icon,TemperatureIcon,ZapIcon,} from "@hugeicons/core-free-icons";+import { StopIcon } from "@/lib/media-control-icons";import { HugeiconsIcon } from "@hugeicons/react";import { Link, useNavigate } from "@tanstack/react-router";import { type ReactElement, type ReactNode, useState } from "react";diff --git a/studio/frontend/src/features/studio/sections/token-preview-dialog.tsx b/studio/frontend/src/features/studio/sections/token-preview-dialog.tsxindex 71b8a3ae2ee..383555a90e7 100644--- a/studio/frontend/src/features/studio/sections/token-preview-dialog.tsx+++ b/studio/frontend/src/features/studio/sections/token-preview-dialog.tsx@@ -29,7 +29,7 @@ import { toast } from "@/lib/toast";import { cn } from "@/lib/utils";import { ShuffleIcon, TextSelectIcon } from "lucide-react";import { type ReactNode, memo, useEffect, useMemo, useState } from "react";-import { Copy01Icon } from "@hugeicons/core-free-icons";+import { Copy01Icon } from "@/lib/copy-icon";import { HugeiconsIcon } from "@hugeicons/react";// Neighbouring tokens alternate shades so their boundaries stay visible.diff --git a/studio/frontend/src/i18n/locales/en.ts b/studio/frontend/src/i18n/locales/en.tsindex da7216c82bb..2fe7b710b97 100644--- a/studio/frontend/src/i18n/locales/en.ts+++ b/studio/frontend/src/i18n/locales/en.ts@@ -1838,10 +1838,10 @@ export const en = {idleSecondsAriaLabel: "Idle auto-unload seconds",mediaEnable: "Switch image and video model by request",mediaEnableDescription:- "Load a downloaded image or video model named in an API request before generating. Its own setting: the one above covers the chat model only. Off by default.",+ "Load a downloaded image or video model named in an API request before generating. Separate from the chat model switch. Off by default.",mediaIdleUnload: "Idle auto-unload for image and video",mediaIdleUnloadDescription:- "Free VRAM by unloading the image and video models after this many idle seconds. Its own setting: the one above covers the chat model only. 0 keeps them loaded, minimum 60.",+ "Free VRAM by unloading the image and video models after this many idle seconds. Separate from the chat model switch. 0 keeps them loaded, minimum 60.",mediaIdleSecondsAriaLabel: "Image and video idle auto-unload seconds",mediaIdlePaused: "Paused while Keep model in GPU memory is on.",idleNeedsEnable: "Turn on Switch model by request first.",@@ -2488,7 +2488,7 @@ export const en = {noRamReserveDescription: "Reduce host RAM held for model weights.",noRamReserveHint: "Skips memory-mapped loading on supported Windows builds when the model is fully offloaded to the GPU, so its pages are not held resident. Otherwise keeps memory-mapped loading. Required CPU buffers can still use RAM. Drops --no-mmap and --mlock.",multiModel: "Keep multiple models loaded",- openSystemSettings: "System settings",+ openSystemSettings: "Open in System",multiModelOff: "Off",multiModelFit: "When they fit",multiModelAlways: "Always",@@ -3210,7 +3210,7 @@ export const en = {accessTokenCopied: "Access token copied",copyAccessToken: "Copy access token",copyNow: "Copy now - this won't be shown again.",- usageExamples: "Usage examples",+ usageExamples: "Chat API",usageNoModel:"Load or download a model to see runnable examples. This server has no model to name yet.",usageTools: "Tools",@@ -3273,7 +3273,7 @@ export const en = {useViaApi: "Use via API",},mediaApi: {- title: "Image and video API",+ title: "Images / Video API",description: "Generate images and videos from your own code with the OpenAI-compatible endpoints.",images: "Images",video: "Video",diff --git a/studio/frontend/src/index.css b/studio/frontend/src/index.cssindex 31a7c67f16e..1f3636fed8a 100644--- a/studio/frontend/src/index.css+++ b/studio/frontend/src/index.css@@ -2864,6 +2864,14 @@ html[data-chat-font] .aui-root {background-color: rgb(255 255 255 / calc(0.1 * var(--contrast-wash-gain, 1)));}+ /* Elevated cards sink the shared track; the API page's buttons lift above them instead. */+ html.dark .api-monitor-page .elevated-card .btn-fill {+ background-color: rgb(255 255 255 / calc(0.06 * var(--contrast-wash-gain, 1)));+ }+ html.dark .api-monitor-page .elevated-card .btn-fill:hover {+ background-color: rgb(255 255 255 / calc(0.1 * var(--contrast-wash-gain, 1)));+ }+/* Settings only: every option picker (select or picker variant) one size; action menus keep theirs. */[data-settings-dialog] :is([data-slot="select-trigger"], [data-variant="picker"]) {height: calc(1.25rem * var(--ui-font-scale, 1) + 14px * var(--ui-space-scale, 1) + 2px) !important;diff --git a/studio/frontend/src/lib/copy-icon.ts b/studio/frontend/src/lib/copy-icon.tsnew file mode 100644index 00000000000..d08ab34337c--- /dev/null+++ b/studio/frontend/src/lib/copy-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";++// Two equal squares a short step apart; the back one only where it shows.+export const Copy01Icon: IconSvgElement = [+ [+ "path",+ {+ d: "M7.25 16.75H6.75A4.5 4.5 0 0 1 2.25 12.25V6.75A4.5 4.5 0 0 1 6.75 2.25H12.25A4.5 4.5 0 0 1 16.75 6.75V7.25",+ stroke: "currentColor",+ strokeLinecap: "round",+ strokeLinejoin: "round",+ strokeWidth: "1.5",+ key: "0",+ },+ ],+ [+ "path",+ {+ d: "M11.75 7.25H17.25A4.5 4.5 0 0 1 21.75 11.75V17.25A4.5 4.5 0 0 1 17.25 21.75H11.75A4.5 4.5 0 0 1 7.25 17.25V11.75A4.5 4.5 0 0 1 11.75 7.25Z",+ stroke: "currentColor",+ strokeLinecap: "round",+ strokeLinejoin: "round",+ strokeWidth: "1.5",+ key: "1",+ },+ ],+];diff --git a/studio/frontend/src/lib/media-control-icons.ts b/studio/frontend/src/lib/media-control-icons.tsnew file mode 100644index 00000000000..66a33b260ce--- /dev/null+++ b/studio/frontend/src/lib/media-control-icons.ts@@ -0,0 +1,41 @@+// 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";++// The stock squircles read as circles once filled small; these keep a small corner radius.+export const StopIcon: IconSvgElement = [+ [+ "path",+ {+ d: "M6.75 4.5H17.25A2.25 2.25 0 0 1 19.5 6.75V17.25A2.25 2.25 0 0 1 17.25 19.5H6.75A2.25 2.25 0 0 1 4.5 17.25V6.75A2.25 2.25 0 0 1 6.75 4.5Z",+ stroke: "currentColor",+ strokeLinejoin: "round",+ strokeWidth: "1.5",+ key: "0",+ },+ ],+];++export const PauseIcon: IconSvgElement = [+ [+ "path",+ {+ d: "M6 4.5H8A1.5 1.5 0 0 1 9.5 6V18A1.5 1.5 0 0 1 8 19.5H6A1.5 1.5 0 0 1 4.5 18V6A1.5 1.5 0 0 1 6 4.5Z",+ stroke: "currentColor",+ strokeLinejoin: "round",+ strokeWidth: "1.5",+ key: "0",+ },+ ],+ [+ "path",+ {+ d: "M16 4.5H18A1.5 1.5 0 0 1 19.5 6V18A1.5 1.5 0 0 1 18 19.5H16A1.5 1.5 0 0 1 14.5 18V6A1.5 1.5 0 0 1 16 4.5Z",+ stroke: "currentColor",+ strokeLinejoin: "round",+ strokeWidth: "1.5",+ key: "1",+ },+ ],+];diff --git a/studio/frontend/tests/account-settings-ui.test.ts b/studio/frontend/tests/account-settings-ui.test.tsindex c01f4a9175d..2351f04821b 100644--- a/studio/frontend/tests/account-settings-ui.test.ts+++ b/studio/frontend/tests/account-settings-ui.test.ts@@ -101,6 +101,7 @@ function tab("@hugeicons/core-free-icons": {},"@hugeicons/react": { HugeiconsIcon: "Icon" },"@/lib/tick-icon": {},+ "@/lib/copy-icon": { Copy01Icon: {} },"@/lib/utils": {cn: (...values: unknown[]) => values.filter(Boolean).join(" "),},diff --git a/studio/frontend/tests/agent-docs-links.test.ts b/studio/frontend/tests/agent-docs-links.test.tsindex 7a7a4f2e16f..82277107063 100644--- a/studio/frontend/tests/agent-docs-links.test.ts+++ b/studio/frontend/tests/agent-docs-links.test.ts@@ -21,8 +21,9 @@ test("the API tab hands owners to the Agents tab and gives other accounts the agconst src = readSrc("features/settings/components/usage-examples.tsx");assert.match(src,- /\{isOwner \? \([\s\S]*?setAgentsTabAgent\(agent\);\s*useSettingsDialogStore\.getState\(\)\.setActiveTab\("agents"\);[\s\S]*?\) : \([\s\S]*?href=\{agentDetails\.docsUrl\}/,+ /\{isOwner \? \([\s\S]*?setAgentsTabAgent\(agent\);[\s\S]{0,300}else useSettingsDialogStore\.getState\(\)\.setActiveTab\("agents"\);[\s\S]*?\) : \([\s\S]*?href=\{agentDetails\.docsUrl\}/,);+ assert.match(src, /if \(agentsOnly\) useSettingsDialogStore\.getState\(\)\.openDialog\("agents"\);/);const visibility = readSrc("features/settings/settings-tab-visibility.ts");assert.match(visibility, /OWNER_ONLY_SETTINGS_TABS[\s\S]*?"agents"/);assert.doesNotMatch(src, /const DOC_LINKS/);diff --git a/studio/frontend/tests/api-settings-tab.test.ts b/studio/frontend/tests/api-settings-tab.test.tsindex 64f50fadcf8..990f947fb06 100644--- a/studio/frontend/tests/api-settings-tab.test.ts+++ b/studio/frontend/tests/api-settings-tab.test.ts@@ -38,7 +38,68 @@ test("usage examples sit right under the keys, where a new key lands", () => {const examples = TAB.indexOf("<UsageExamples");assert.ok(examples > TAB.indexOf("<CreateKeyForm"));assert.ok(examples < TAB.indexOf("<MonitorLink />"));- assert.ok(examples < TAB.indexOf("<KeylessApiAccessSection"));+ 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");+ 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}"`));+ }+ 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"],+ ["decision-api-section.tsx", "api-keys-decision-api"],+ ]) {+ 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(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 : \(/);+ for (const icon of ["MessageCircleIcon", "Image01Icon", "AiSpeechIcon", "TaskDone01Icon", "BotIcon"]) {+ assert.match(monitor, new RegExp(`label: "[^"]+", 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,+ /<h2 className="settings-heading flex items-center gap-2 text-base font-semibold font-heading">\s*<HugeiconsIcon\s+icon=\{TaskDone01Icon\}/,+ );+});++test("keyless API access is edited on Remote & LAN; the API tab links there and reads it for the examples", () => {+ const link = readSrc("features/settings/components/keyless-api-access-link.tsx");+ assert.match(link, /openDialog\("remote-lan", \{ scrollTarget: "remote-lan-keyless" \}\)/);+ const remoteLan = readSrc("features/settings/tabs/remote-lan-tab.tsx");+ assert.match(remoteLan, /scrollTarget !== "remote-lan-keyless"/);+ assert.match(remoteLan, /<div ref=\{keylessRef\}>\s*<KeylessApiAccessSection \/>/);+ assert.match(TAB, /loadKeylessApiAccess\(\)/);+ assert.match(TAB, /scope: next\.suspendedByAccounts \? "off" : next\.scope/);+ assert.doesNotMatch(TAB, /<KeylessApiAccessSection/);});test("the remote and LAN polls skip their request while the tab is hidden", () => {diff --git a/studio/frontend/tests/debug-log-export.test.ts b/studio/frontend/tests/debug-log-export.test.tsindex ac9f9b65d9f..3b46df385b1 100644--- a/studio/frontend/tests/debug-log-export.test.ts+++ b/studio/frontend/tests/debug-log-export.test.ts@@ -198,6 +198,7 @@ function makeWorld(options: {"@hugeicons/core-free-icons": new Proxy({}, { get: () => ({}) }),"@hugeicons/react": { HugeiconsIcon: () => null },"@/lib/tick-icon": { Tick02Icon: {} },+ "@/lib/copy-icon": { Copy01Icon: {} },"lucide-react": { ArrowDownIcon: () => null },"../api/debug-logs": api,"../components/settings-row": {diff --git a/studio/frontend/tests/library-chats.test.ts b/studio/frontend/tests/library-chats.test.tsindex b7e3c175c4f..e40164d98cf 100644--- a/studio/frontend/tests/library-chats.test.ts+++ b/studio/frontend/tests/library-chats.test.ts@@ -446,16 +446,35 @@ test("grid cards share a two-line title and a footer of contents over date", ()cardOf("export function SectionCard(", "export function SectionRow("),];for (const card of cards) {- assert.match(card, /className=\{CARD_TITLE\}/);+ assert.match(card, /className=\{cn\(CARD_TITLE, !showTile && TILELESS_TITLE\)\}/);assert.match(card, /<span className="line-clamp-2">/);assert.match(card, /<CardFooter/);+ assert.match(card, /showTile = true,/);+ assert.match(card, /className=\{cn\("flex items-center gap-2", !showTile && TILELESS_ROW\)\}/);}assert.doesNotMatch(cards[0], /modelLabel|model &&/);- assert.match(cards[0], /<ChatBadges chat=\{chat\} marksOnly \/>/);+ assert.match(cards[0], /<ChatBadges chat=\{chat\} marksOnly=\{showTile\} \/>/);assert.doesNotMatch(cards[1], /archived/);assert.match(cards[0], /<ChatLocation[^>]*plain/);});+test("cards drop the kind tile everywhere but All, which mixes chats, projects and sections", () => {+ const library = readSrc("features/library/chats/chats-library.tsx");+ assert.match(library, /<ChatCard[^>]*showTile=\{shownEntries !== null\}/s);+ assert.match(library, /<ChatRow[^>]*showTile=\{shownEntries !== null\}/s);+ assert.equal(library.split("showTile={false}").length - 1, 6);+ const favorites = library.slice(library.indexOf("function favoriteEntries("));+ assert.doesNotMatch(favorites.slice(0, favorites.indexOf("cards:")), /showTile/);+ const items = readSrc("features/library/chats/chats-items.tsx");+ for (const row of ["export function ChatRow(", "export function ProjectRow(", "export function SectionRow("]) {+ const body = items.slice(items.indexOf(row), items.indexOf(row) + 2500);+ assert.match(body, /showTile = true,/, row);+ assert.match(body, /\{showTile && <(ChatTile|CollectionTile)/, row);+ }+ const mixedCards = library.slice(library.indexOf("const entryRow ="), library.indexOf("return (", library.indexOf("const entryRow =")));+ assert.doesNotMatch(mixedCards, /showTile=\{false\}/);+});+test("project cards in the grid leave out the instructions", () => {const items = readSrc("features/library/chats/chats-items.tsx");const card = items.slice(items.indexOf("export function ProjectCard("), items.indexOf("export function ProjectRow("));diff --git a/studio/frontend/tests/llama-extra-args-diagnostics.test.ts b/studio/frontend/tests/llama-extra-args-diagnostics.test.tsindex 39c0301a6de..7aa8476d5d3 100644--- a/studio/frontend/tests/llama-extra-args-diagnostics.test.ts+++ b/studio/frontend/tests/llama-extra-args-diagnostics.test.ts@@ -592,7 +592,7 @@ test("the panel's own Load goes through the runtime, which sends them too", () =const runtime = readSrc("features/chat/hooks/use-chat-model-runtime.ts").replace(/\s+/g, " ");assert.match(runtime,- /const loadLlamaExtraArgs = pendingLoadConfig\?\.llamaExtraArgs/,+ /let loadLlamaExtraArgs = pendingLoadConfig\?\.llamaExtraArgs/,);assert.match(runtime,diff --git a/studio/frontend/tests/load-body-remembered-knobs.test.ts b/studio/frontend/tests/load-body-remembered-knobs.test.tsnew file mode 100644index 00000000000..f31b34f81dc--- /dev/null+++ b/studio/frontend/tests/load-body-remembered-knobs.test.ts@@ -0,0 +1,42 @@+// 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 { readFileSync } from "node:fs";+import path from "node:path";+import { test } from "node:test";+import { fileURLToPath } from "node:url";++const HERE = path.dirname(fileURLToPath(import.meta.url));+const read = (rel: string) => readFileSync(path.join(HERE, "..", rel), "utf8");+const ADAPTER = read("src/features/chat/api/chat-adapter.ts");+const RUNTIME = read("src/features/chat/hooks/use-chat-model-runtime.ts");++test("a startup auto-load sends the remembered split for the GPUs it resolved", () => {+ assert.match(+ ADAPTER,+ /reconcileTensorSplit\(\s*config\.tensorSplit,\s*config\.selectedGpuIds,\s*effectiveGpuIds,\s*\)/,+ );+ assert.match(ADAPTER, /tensor_split: effectiveTensorSplit \?\? undefined,/);+ assert.doesNotMatch(ADAPTER, /split ratio is never remembered/);+});++test("a picker load sanitizes its stored extra args before sending them", () => {+ const start = RUNTIME.indexOf(+ "let loadLlamaExtraArgs = pendingLoadConfig?.llamaExtraArgs;",+ );+ assert.ok(start > 0);+ const block = RUNTIME.slice(start, start + 1400);+ assert.match(block, /isGguf &&\s*!targetIsDiffusion &&/);+ assert.match(+ block,+ /loadLlamaExtraArgs != null &&\s*loadLlamaExtraArgs\.length > 0/,+ );+ assert.match(block, /await loadManagedLlamaFlags\(\)/);+ assert.match(+ block,+ /sanitizeStoredExtraArgs\(\s*loadLlamaExtraArgs,\s*managed\?\.managed \?\? new Set<string>\(\),\s*\{\s*maxBytes: managed\?\.maxBytes,\s*windowsCommandBudget: managed\?\.windowsCommandBudget,/,+ );+ assert.match(block, /loadLlamaExtraArgs = cleaned;/);+});diff --git a/studio/frontend/tests/mcp-access-section.test.ts b/studio/frontend/tests/mcp-access-section.test.tsindex f8a3eb6b2e8..921d70b5caa 100644--- a/studio/frontend/tests/mcp-access-section.test.ts+++ b/studio/frontend/tests/mcp-access-section.test.ts@@ -30,10 +30,14 @@ 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, beside keyless access, and settings search finds it", () => {+test("only the owner sees it, under the Agents heading, and settings search finds it", () => {assert.match(API_TAB,- /\{isOwner \? \(\s*<>\s*<KeylessApiAccessSection onSettingsChange=\{setKeyless\} \/>\s*<McpAccessSection apiKey=\{revealed\} \/>\s*<\/>\s*\) : null\}/,+ /agentsExtra=\{isOwner \? <McpAccessSection apiKey=\{revealed\} \/> : null\}/,+ );+ assert.match(+ API_TAB,+ /\{isOwner \? <KeylessApiAccessLink \/> : null\}/,);assert.doesNotMatch(SECTION, /useIsAccountOwner/);assert.match(diff --git a/studio/frontend/tests/model-config-draft.test.ts b/studio/frontend/tests/model-config-draft.test.tsindex f5baf2ddc1e..6989474c129 100644--- a/studio/frontend/tests/model-config-draft.test.ts+++ b/studio/frontend/tests/model-config-draft.test.ts@@ -20,6 +20,7 @@ import {readModelConfigDraft,replaceModelConfigDraft,retainModelConfigDraft,+ setModelConfigDraftPickedSet,setModelConfigDraftRemember,} from "../src/features/model-picker/model-config/model-config-draft.ts";import type { PerModelConfig } from "../src/features/model-picker/model-config/per-model-config.ts";@@ -72,6 +73,20 @@ test("a new live signature re-seeds the draft from the resident process", () =>assert.equal(reseeded?.appliedLiveSignature, "sig-b");});+test("a one-time pick is shared by both editors until the draft is replaced or re-seeded", () => {+ const key = modelConfigDraftKey(MODEL, "Q6_K");+ primeModelConfigDraft(key, { config: SEED, remembered: true }, "sig-a");+ setModelConfigDraftPickedSet(key, "Other");+ patchModelConfigDraft(key, { nParallel: 2 });+ assert.equal(readModelConfigDraft(key)?.pickedSet, "Other");+ replaceModelConfigDraft(key, SEED);+ assert.equal(readModelConfigDraft(key)?.pickedSet, undefined);+ setModelConfigDraftPickedSet(key, null);+ assert.equal(readModelConfigDraft(key)?.pickedSet, null);+ primeModelConfigDraft(key, { config: SEED, remembered: true }, "sig-b");+ assert.equal(readModelConfigDraft(key)?.pickedSet, undefined);+});+test("remember toggle keeps saved baseline until save", () => {const key = modelConfigDraftKey(MODEL, "Q8_0");primeModelConfigDraft(key, { config: SEED, remembered: false }, "none");diff --git a/studio/frontend/tests/model-override-eviction.test.ts b/studio/frontend/tests/model-override-eviction.test.tsnew file mode 100644index 00000000000..2273518d246--- /dev/null+++ b/studio/frontend/tests/model-override-eviction.test.ts@@ -0,0 +1,55 @@+// 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, { after } from "node:test";+import { createServer } from "vite";+import { installLocalStorageFake } from "./helpers/kit.ts";++installLocalStorageFake();+Object.assign(window.location, { href: "http://localhost/" });+const vite = await createServer({ server: { middlewareMode: true } });+after(() => vite.close());+const overrides = await vite.ssrLoadModule(+ "/src/features/model-picker/api/model-overrides.ts",+);++async function bodyOf(+ config: unknown,+ options?: Record<string, unknown>,+): Promise<Record<string, unknown>> {+ const bodies: Record<string, unknown>[] = [];+ const original = globalThis.fetch;+ globalThis.fetch = (async (_url, init) => {+ bodies.push(JSON.parse(String(init?.body)));+ return Response.json({ overrides: {}, removed_keys: [] });+ }) as typeof fetch;+ try {+ await overrides.putModelOverride("org/model", "Q4_K_M", config, options);+ } finally {+ globalThis.fetch = original;+ }+ assert.equal(bodies.length, 1);+ return bodies[0];+}++test("an eviction clears the engine group and MLX offloads but keeps the launch flags", async () => {+ const body = await bodyOf(null, { keepLaunchFlags: true });+ assert.equal(body.remove, false);+ assert.equal("llama_extra_args" in body, false);+ assert.equal(body.engine, "auto");+ assert.equal(body.engine_precision, "auto");+ assert.equal(body.engine_parallelism, "tensor");+ assert.equal(body.engine_kv_cache_dtype, "auto");+ assert.equal(body.engine_seed, null);+ assert.equal(body.engine_gpu_memory_utilization, null);+ assert.equal(body.mlx_ple_offload, null);+ assert.equal(body.mlx_expert_offload, null);+});++test("a forget still sends an explicit empty flag list and no fields", async () => {+ const body = await bodyOf(null);+ assert.equal(body.remove, true);+ assert.deepEqual(body.llama_extra_args, []);+ assert.equal("engine" in body, false);+});diff --git a/studio/frontend/tests/saved-run-settings.test.ts b/studio/frontend/tests/saved-run-settings.test.tsindex 40866830853..7299f8b9967 100644--- a/studio/frontend/tests/saved-run-settings.test.ts+++ b/studio/frontend/tests/saved-run-settings.test.ts@@ -16,9 +16,10 @@ const { store } = installLocalStorageFake();const saved = await import("../src/features/model-picker/model-config/saved-run-settings.ts");-const { DEFAULT_PER_MODEL_CONFIG, resolveInitialConfig } = await import(+const perModel = await import("../src/features/model-picker/model-config/per-model-config.ts");+const { DEFAULT_PER_MODEL_CONFIG, resolveInitialConfig } = perModel;const MODEL = "unsloth/Repo-GGUF";const config = (customContextLength: number | null) => ({@@ -28,6 +29,58 @@ const config = (customContextLength: number | null) => ({test.beforeEach(() => store.clear());+test("a one-time load is remembered per quant until a regular load clears it", () => {+ const sent = { ...config(4096), maxSeqLength: 8192 };+ saved.noteRunSettingsLoadedOnce(MODEL, "Q4_K_M", { name: "Other", sent });+ const noted = saved.getRunSettingsLoadedOnce(MODEL, "q4_k_m");+ assert.equal(noted?.name, "Other");+ assert.equal(noted?.sent.maxSeqLength, 8192);+ assert.equal(noted?.sent.customContextLength, 4096);+ assert.equal(saved.getRunSettingsLoadedOnce(MODEL, "Q8_0"), null);+ // Stored, so it survives a refresh while the model stays loaded.+ assert.ok(store.get(saved.LOADED_ONCE_RUN_SETTINGS_STORAGE_KEY));+ saved.noteRunSettingsLoadedOnce(MODEL, "Q4_K_M", null);+ assert.equal(saved.getRunSettingsLoadedOnce(MODEL, "Q4_K_M"), null);+});++test("the editor names a one-time load by what it sent, before matching saved sets", () => {+ const page = readFileSync(+ new URL(+ "../src/features/model-picker/components/model-config-page.tsx",+ import.meta.url,+ ),+ "utf8",+ );+ assert.match(+ page,+ /noteRunSettingsLoadedOnce\(\s*configId,\s*target\.ggufVariant,\s*onceOnly \? \{ name: loadSet, sent: onceSent \} : null,\s*\);/,+ );+ assert.match(+ page,+ /perModelConfigsEqual\(forSetStore\(loaded\), forSetStore\(noted\.sent\)\)[\s\S]{0,200}findSavedRunSettings\(savedSets, noted\.name\)/,+ );+ // The record wins, a Default (null) one too, before the pin-equality shortcut.+ assert.match(+ page,+ /const notedOnce = inferOnce \? loadedOnceNamed\(loadedConfig\) : undefined;/,+ );+ assert.match(+ page,+ /notedOnce !== undefined\s*\? notedOnce\s*: inferOnce &&\s*!perModelConfigsEqual\(forSetStore\(loadedConfig\), forSetStore\(pinnedEntry\.config\)\)/,+ );+ assert.doesNotMatch(page, /loadedOnceNamed\(loadedConfig\) \?\?/);+ // Inherited speculative decoding is recorded as the mode the runtime resolves and reports.+ assert.match(+ page,+ /speculativeType:\s*normalizeSpeculativeType\(effectiveLoadConfig\.speculativeType\) \?\?\s*readPersistedSpeculativeType\(\),[\s\S]{0,200}onceOnly \? \{ name: loadSet, sent: onceSent \} : null/,+ );+ // Recorded as submitted: the load strips managed arguments, so the record does too.+ assert.match(+ page,+ /if \(cleaned\.length === onceArgs\.length\) return;\s*noteRunSettingsLoadedOnce\(configId, target\.ggufVariant, \{\s*name: loadSet,\s*sent: \{ \.\.\.onceSent, llamaExtraArgs: cleaned \},/,+ );+});+test("one model keeps several named settings, listed by name", () => {assert.ok(saved.saveRunSettings(MODEL, "Long context", config(32768)));assert.ok(saved.saveRunSettings(MODEL, " Fast ", config(4096)));@@ -212,41 +265,47 @@ test("settings remembered before named sets show up as one, and are not duplicatassert.equal(saved.listSavedRunSettings(MODEL).length, 2);});-test("sets named by earlier builds take the model's custom settings name", () => {- const legacy = "unsloth/Legacy-GGUF";- saved.saveRunSettings(legacy, "Saved settings", config(4096));- saved.saveRunSettings(legacy, "Custom setting for SmolLM 2", config(2048));- saved.saveRunSettings(- legacy,- "Custom setting for SmolLM tuned",- config(1024),- );- saved.setSelectedRunSettings(legacy, "Q4_K_M", "Saved settings");- assert.ok(- saved.hasLegacyRunSettings(saved.listSavedRunSettings(legacy), "SmolLM"),- );- saved.renameLegacyRunSettings(legacy, "SmolLM");- // A name the user typed that only starts the same way is theirs, not an old default.+test("a name the user picks is kept as typed", () => {+ saved.saveRunSettings(MODEL, "Fast", config(4096));+ assert.ok(saved.renameSavedRunSettings(MODEL, "Fast", "Saved settings"));+ saved.saveRunSettings(MODEL, "Custom setting for Repo-GGUF", config(2048));assert.deepEqual(saved- .listSavedRunSettings(legacy)- .map((entry: { name: string }) => entry.name)- .sort(),- [- "Custom setting for SmolLM tuned",- "SmolLM custom settings",- "SmolLM custom settings 2",- ],+ .listSavedRunSettings(MODEL)+ .map((entry: { name: string }) => entry.name),+ ["Custom setting for Repo-GGUF", "Saved settings"],);assert.equal(- saved.getSelectedRunSettings(legacy, "Q4_K_M"),- "SmolLM custom settings",- );- assert.ok(- !saved.hasLegacyRunSettings(saved.listSavedRunSettings(legacy), "SmolLM"),+ "renameLegacyRunSettings" in saved || "hasLegacyRunSettings" in saved,+ false,);});+test("the per-model limit is reported only for a new name", () => {+ for (let n = 0; n < saved.SAVED_RUN_SETTINGS_PER_MODEL_MAX; n++) {+ assert.ok(saved.saveRunSettings(MODEL, `Set ${n}`, config(1024 + n * 128)));+ }+ assert.equal(saved.isRunSettingsLimitReached(MODEL, "One more"), true);+ assert.equal(saved.saveRunSettings(MODEL, "One more", config(4096)), false);+ assert.equal(saved.isRunSettingsLimitReached(MODEL, "set 3"), false);+ assert.ok(saved.saveRunSettings(MODEL, "Set 3", config(4096)));+});++test("forgetting a quant's server settings puts its selection back on Default", () => {+ const { savePerModelConfig } = perModel;+ saved.saveRunSettings(MODEL, "Fast", config(4096));+ assert.ok(savePerModelConfig(MODEL, "Q4_K_M", config(4096)));+ assert.ok(savePerModelConfig(MODEL, "Q8_0", config(4096)));+ saved.setSelectedRunSettings(MODEL, "Q4_K_M", "Fast");+ saved.setSelectedRunSettings(MODEL, "Q8_0", "Fast");+ assert.ok(saved.forgetPerModelConfigsForOverrideKeys([`${MODEL}:q4_k_m`]));+ assert.equal(resolveInitialConfig(MODEL, "Q4_K_M").remembered, false);+ assert.equal(saved.getSelectedRunSettings(MODEL, "Q4_K_M"), null);+ assert.equal(saved.getSelectedRunSettings(MODEL, "Q8_0"), "Fast");+ assert.deepEqual(saved.quantsSelectingRunSettings(MODEL, "Fast"), ["Q8_0"]);+ assert.equal(saved.listSavedRunSettings(MODEL).length, 1);+});+test("run settings use one dropdown and one Save, with no Remember checkbox", () => {const page = readFileSync(new URL(@@ -292,10 +351,9 @@ test("run settings use one dropdown and one Save, with no Remember checkbox", ()/selectedSet === null && !atDefault \? newRunSettingsName\(savedSets, modelName\)/,);assert.match(page, /\} else \{\s*handleSave\(customName\);/);- // Reset goes back to Default settings at once, not just the panel values.assert.match(page,- /disabled=\{\(atDefault && selectedSet === null\) \|\| extraArgsHydrating \|\| budgetSettling\}[\s\S]{0,160}onClick=\{\(\) => pickSet\(null\)\}/,+ /\(pinnedSet !== null\s*\? selectedSet === pinnedSet && !setUnsaved\s*: atDefault && selectedSet === null\) \|\|\s*extraArgsHydrating \|\|\s*budgetSettling\s*\}\s*onClick=\{\(\) => pickSet\(pinnedSet\)\}/,);// A number the Save or Load click itself committed is not in customName yet, so both name the// new set from the committed config.@@ -359,3 +417,127 @@ test("row icons never pick their row", () => {// New settings come from editing Default, so the menu has no create entry.assert.doesNotMatch(row, /Save as new/);});++test("a set whose record was forgotten is not offered, and deleting one asks first", () => {+ const page = readFileSync(+ new URL(+ "../src/features/model-picker/components/model-config-page.tsx",+ import.meta.url,+ ),+ "utf8",+ );+ assert.match(+ page,+ /const selectionStale =\s*persistedEntry !== null &&\s*!extraArgsHydrating &&\s*!storedRecord\.remembered &&\s*!savedRemember &&\s*!isDefaultConfig\(forSetStore\(persistedEntry\.config\)\);/,+ );+ assert.match(+ page,+ /if \(selectionStale\) \{\s*setSelectedRunSettings\(configId, target\.ggufVariant, null\);/,+ );+ assert.match(page, /selectionStale\s*\? null\s*: \(persistedSet \?\? null\)/);+ assert.match(page, /onDelete=\{setPendingDelete\}/);+ assert.match(+ page,+ /if \(pendingDelete !== null\) \{\s*deleteSet\(pendingDelete\);/,+ );+ assert.match(page, /isRunSettingsLimitReached\(configId, name\)/);+ assert.doesNotMatch(page, /persistenceOnly|rememberChanged/);+});++test("rows can be renamed and deleted from the keyboard", () => {+ const row = readFileSync(+ new URL(+ "../src/features/model-picker/components/saved-run-settings-row.tsx",+ import.meta.url,+ ),+ "utf8",+ );+ assert.match(row, /aria-keyshortcuts="F2 Delete"/);+ // Radix dismisses from a document capture listener unless prevented, so the guard is on window capture.+ assert.match(row, /window\.addEventListener\("keydown", keepPanel, true\)/);+ assert.match(+ row,+ /closest\("\[data-run-settings-name\]"\)[\s\S]{0,40}event\.preventDefault\(\)/,+ );+ assert.match(row, /event\.key === "F2"[\s\S]{0,80}rename\(entry\.name\)/);+ assert.match(row, /event\.key === "Delete"[\s\S]{0,80}remove\(entry\.name\)/);+});++test("a pinned set follows renames and goes with its set or a forget", () => {+ saved.saveRunSettings(MODEL, "Mine", config(4096));+ saved.saveRunSettings(MODEL, "Trial", config(2048));+ assert.equal(saved.getPinnedRunSettings(MODEL, "Q4_K_M"), null);+ assert.ok(saved.setPinnedRunSettings(MODEL, "q4_k_m", "Mine"));+ assert.equal(saved.getPinnedRunSettings(MODEL, "Q4_K_M"), "Mine");+ assert.equal(saved.getPinnedRunSettings(MODEL, "Q8_0"), null);+ saved.noteRunSettingsLoadedOnce(MODEL, "Q8_0", {+ name: "Mine",+ sent: config(4096),+ });+ assert.ok(saved.renameSavedRunSettings(MODEL, "Mine", "Long context"));+ assert.equal(saved.getPinnedRunSettings(MODEL, "Q4_K_M"), "Long context");+ // A one-time load of the set keeps naming it.+ assert.equal(+ saved.getRunSettingsLoadedOnce(MODEL, "Q8_0")?.name,+ "Long context",+ );+ assert.ok(saved.deleteSavedRunSettings(MODEL, "Trial"));+ assert.equal(saved.getPinnedRunSettings(MODEL, "Q4_K_M"), "Long context");+ assert.ok(saved.deleteSavedRunSettings(MODEL, "Long context"));+ assert.equal(saved.getPinnedRunSettings(MODEL, "Q4_K_M"), null);++ saved.saveRunSettings(MODEL, "Mine", config(4096));+ saved.setPinnedRunSettings(MODEL, "Q4_K_M", "Mine");+ assert.ok(perModel.savePerModelConfig(MODEL, "Q4_K_M", config(4096)));+ saved.forgetPerModelConfigsForOverrideKeys([`${MODEL}:Q4_K_M`]);+ assert.equal(saved.getPinnedRunSettings(MODEL, "Q4_K_M"), null);+ assert.ok(saved.setPinnedRunSettings(MODEL, "Q4_K_M", "Mine"));+ assert.ok(saved.setPinnedRunSettings(MODEL, "Q4_K_M", null));+ assert.equal(saved.getPinnedRunSettings(MODEL, "Q4_K_M"), null);+});++test("while a set is pinned, picking or loading another uses it once", () => {+ const page = readFileSync(+ new URL(+ "../src/features/model-picker/components/model-config-page.tsx",+ import.meta.url,+ ),+ "utf8",+ );+ assert.match(+ page,+ /const pickSet = \(name: string \| null, pinned = pinnedSet\) => \{[\s\S]{0,400}if \(pinned !== null && entry\?\.name !== pinned\) \{\s*applyToPanel\(next\);\s*setPickedSet\(entry\?\.name \?\? null\);\s*return;/,+ );+ assert.match(+ page,+ /const onceOnly = pinnedSet !== null && loadSet !== pinnedSet;\s*const \{ saved \} = onceOnly\s*\? \{ saved: true \}\s*: persistConfig\(effectiveRuntimeConfig, loadSet !== null\);/,+ );+ assert.match(page, /if \(!keep && pinned !== null\) \{\s*return false;/);+ assert.match(+ page,+ /if \(pinned !== null && target !== pinned\) \{[\s\S]{0,120}setPickedSet\(target\);/,+ );+ assert.match(+ page,+ /const setAlwaysLoad = [\s\S]*?const name = selectedSet \?\? customName;[\s\S]*?setPinnedRunSettings\(configId, target\.ggufVariant, name\)[\s\S]*?if \(selectedSet === null \|\| setUnsaved\) \{\s*if \(!handleSave\(name, message, name\)\)[\s\S]*?pickSet\(selectedSet, selectedSet\);/,+ );+ assert.match(page, /Always load with these settings/);+ assert.match(+ page,+ /<Checkbox\s+id=\{alwaysLoadId\}[\s\S]{0,1600}<\/label>\s*<p\s+id=\{saveStatusId\}[\s\S]{0,500}\{saveStatus\}\s*<\/p>\s*<\/div>/,+ );+ assert.match(+ page,+ /if \(!\(loadedConfig && getPinnedRunSettings\(configId, target\.ggufVariant\) !== null\)\) \{\s*setExtraArgsLoadable\(hydratedIsLoadable\);\s*replaceModelConfigDraft\(/,+ );+ assert.match(page, /const pickedSet = draftSnapshot\?\.pickedSet;/);+ assert.match(page, /setModelConfigDraftPickedSet\(draftKey, next\)/);+ assert.match(+ page,+ /useEffect\(\(\) => \{\s*if \(loadedOnce !== undefined\) setPickedSet\(loadedOnce\);\s*\}, \[loadedOnce, setPickedSet\]\);/,+ );+ assert.match(+ page,+ /if \(name === pinnedSet\) \{[\s\S]{0,120}pickSet\(wasSelected \? null : selectedSet, null\);/,+ );+});diff --git a/studio/frontend/tests/tool-code-cell-bidi.test.ts b/studio/frontend/tests/tool-code-cell-bidi.test.tsindex 759017ebf93..96e0416f8f3 100644--- a/studio/frontend/tests/tool-code-cell-bidi.test.ts+++ b/studio/frontend/tests/tool-code-cell-bidi.test.ts@@ -37,6 +37,7 @@ const { ToolCodeCell } = loadWithStubs<typeof ToolCodeCellModule>(isDownloadCancelled: () => false,},"@/lib/tick-icon": { Tick02Icon: {} },+ "@/lib/copy-icon": { Copy01Icon: {} },"@/lib/toast": { toast: { error() {} } },"@hugeicons/core-free-icons": { Copy01Icon: {}, Download01Icon: {} },"@hugeicons/react": { HugeiconsIcon: () => null },diff --git a/studio/frontend/tests/vram-budget.test.ts b/studio/frontend/tests/vram-budget.test.tsindex 81de6d279cb..460fe4e16eb 100644--- a/studio/frontend/tests/vram-budget.test.ts+++ b/studio/frontend/tests/vram-budget.test.ts@@ -344,7 +344,7 @@ test("Reload is reachable when only the server-wide budget changed", () => {// The budget is on no per-model field, so the page baseline never changes.assert.match(pageSource.replace(/\s+/g, " "),- /isActiveModel && atBaseline && !rememberChanged && !budgetReloadRequired/,+ /isActiveModel && atBaseline && !budgetReloadRequired/,);assert.match(pageSource.replace(/\s+/g, " "),diff --git a/tests/studio/test_chat_autoload_failure_gate.py b/tests/studio/test_chat_autoload_failure_gate.pyindex a826a6494d7..b719f0c905a 100644--- a/tests/studio/test_chat_autoload_failure_gate.py+++ b/tests/studio/test_chat_autoload_failure_gate.py@@ -545,6 +545,7 @@ function unreportedWindowMaxTokens(g: boolean, held: number) { return g ? held :function resolveManualAutoCtxPin(..._a: any[]) { return null; }async function ensureGpuDeviceCache() {}function reconcilePersistedGpuIds(ids: any) { return ids; }+function reconcileTensorSplit(..._a: any[]) { return null; }function saveSpeculativeType(_x: any) {}function persistGpuMemoryModeOnLoad(..._a: any[]) {}function reasoningCapsFromLoad(_x: any) { return {}; }diff --git a/tests/studio/test_model_picker_contracts.py b/tests/studio/test_model_picker_contracts.pyindex 8e7213b6237..529a135ccdc 100644--- a/tests/studio/test_model_picker_contracts.py+++ b/tests/studio/test_model_picker_contracts.py@@ -1103,13 +1103,12 @@ def test_same_click_commit_covers_all_numeric_inputs():)-def test_context_commit_rechecks_persistence_only_shortcut():- """Committed context changes must bypass persistence-only saves."""+def test_load_always_runs_the_committed_config():+ """Load has no save-only shortcut left: Save is its own button, so a committed edit always loads."""src = _read("features/model-picker/components/model-config-page.tsx")assert "const effectiveConfig =" in src- assert "perModelConfigsEqual(effectiveConfig, baseline, {" in src- assert "const effectivePersistenceOnly =" in src- assert "if (effectivePersistenceOnly)" in src+ assert "const { effectiveRuntimeConfig, effectiveMaxSeqLengthValue } = commitDraft();" in src+ assert "effectivePersistenceOnly" not in srcdef test_reset_enabled_for_explicit_context_pin_at_native():@@ -1451,7 +1450,7 @@ def test_save_settings_is_not_rendered_when_it_could_do_nothing():gate = " ".join(_save_button_gate().split())assert "!canSave" in gate, gatepage = " ".join(_read("features/model-picker/components/model-config-page.tsx").split())- assert "? !atDefault || savedRemember" in page+ assert "? !atDefault || (savedRemember && !loadsOnce)" in pagedef test_save_settings_reflects_the_context_it_pinned():@@ -3198,20 +3197,21 @@ def test_run_settings_page_keeps_its_identifying_controls():assert 'aria-label="Back to model list"' in pageassert 'ariaLabel="Context Length"' in pageassert 'aria-label="Context Length"' in page- # The button element, not the word: "Reset" also appears in comments. Reset picks Default- # settings, which fills the panel with DEFAULT_PER_MODEL_CONFIG.+ # The button element, not the word: "Reset" also appears in comments. Reset picks the pinned set,+ # else Default settings, which fills the panel with DEFAULT_PER_MODEL_CONFIG.reset = any(- "onClick={() => pickSet(null)}" in el.group(0) and re.search(r">\s*Reset\s*<", el.group(0))+ "onClick={() => pickSet(pinnedSet)}" in el.group(0)+ and re.search(r">\s*Reset\s*<", el.group(0))for el in re.finditer(r"<Button\b.*?</Button>", page, re.S))assert reset, "the Reset button's JSX is gone or no longer named Reset"assert "const next = entry?.config ?? DEFAULT_PER_MODEL_CONFIG;" in page-def test_the_primary_action_keeps_its_four_labels():+def test_the_primary_action_keeps_its_labels():"""The driver sweeps these names to find the one button the panel shows."""page = _read("features/model-picker/components/model-config-page.tsx")- for label in ('"Save settings"', '"Forget settings"', '"Reload model"', '"Load model"'):+ for label in ('"Reload model"', '"Load model"'):assert label in page, label# The labels live in a calculation, so require a button that renders them. Other props# contain braces, so match whole elements first.diff --git a/tests/studio/test_settings_compact_overflow_contract.py b/tests/studio/test_settings_compact_overflow_contract.pyindex 1da76bdc11b..36de6453e60 100644--- a/tests/studio/test_settings_compact_overflow_contract.py+++ b/tests/studio/test_settings_compact_overflow_contract.py@@ -50,7 +50,10 @@ def test_api_monitor_entries_and_expanded_text_can_shrink():def test_settings_monitor_link_can_shrink():source = MONITOR_LINK.read_text(encoding = "utf-8")assert "flex w-full min-w-0 items-center gap-3" in source- assert '<span className="truncate text-xs text-muted-foreground">' in source+ assert '<span className="truncate text-sm font-semibold text-foreground">' in source+ assert '<span className="min-h-[1lh] truncate text-xs text-muted-foreground">' in source+ # The monitor has a section heading of its own, not a card dropped among other sections.+ assert '<SettingsSection title={t("settings.resources.liveMonitor.apiTitle")}>' in sourcedef test_remote_access_card_can_shrink():