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: orange Full access in permission menus, sandbox docs link, Confirm (#15504)
Michael Han5933ddc8254c
diff --git a/studio/frontend/src/features/chat/index.ts b/studio/frontend/src/features/chat/index.tsindex 71699cb6aa9..b894e805205 100644--- a/studio/frontend/src/features/chat/index.ts+++ b/studio/frontend/src/features/chat/index.ts@@ -116,7 +116,7 @@ export {usePermissionModeChoice,useSandboxCapability,} from "./permission-mode-select";-export { sandboxSwitchState } from "./sandbox-level";+export { SANDBOX_DOCS_URL, sandboxSwitchState } from "./sandbox-level";export { pickSandboxLevel } from "./sandbox-pick";export { SandboxSetupDialog } from "./sandbox-setup-dialog";export {diff --git a/studio/frontend/src/features/chat/permission-mode-select.tsx b/studio/frontend/src/features/chat/permission-mode-select.tsxindex 31c5239bc25..9aa6683f8dc 100644--- a/studio/frontend/src/features/chat/permission-mode-select.tsx+++ b/studio/frontend/src/features/chat/permission-mode-select.tsx@@ -31,6 +31,7 @@ import {import { ChevronDownStandardIcon, ChevronRightStandardIcon } from "@/lib/chevron-icons";import { ShieldAlertGlyph } from "@/lib/shield-alert-icon";import { SparklesGlyph } from "@/lib/sparkles-icon";+import { openExternalLink } from "@/lib/open-link";import { MenuTickIcon } from "@/lib/tick-icon";import { cn } from "@/lib/utils";import {@@ -44,7 +45,7 @@ import {loadSandboxCapability,onSandboxCapabilityChange,} from "./api/sandbox-capability";-import { sandboxSwitchState } from "./sandbox-level";+import { SANDBOX_DOCS_URL, sandboxSwitchState } from "./sandbox-level";import {pickSandboxLevel,} from "./sandbox-pick";@@ -157,7 +158,6 @@ function SandboxLevelMenuPicker({ onOsSandboxMissing }: { onOsSandboxMissing?: (const sandboxLevel = useChatRuntimeStore((s) => s.sandboxLevel);const setSandboxLevel = useChatRuntimeStore((s) => s.setSandboxLevel);const setSandboxSetupOpen = useSandboxSetupDialogStore((s) => s.setOpen);- const openSettings = useSettingsDialogStore((s) => s.openDialog);const { permissionMode } = useAccountPermissionMode();const capability = useSandboxCapability(sandboxLevel === "high");const { checked, disabled } = sandboxSwitchState(sandboxLevel, permissionMode, capability);@@ -252,13 +252,7 @@ function SandboxLevelMenuPicker({ onOsSandboxMissing }: { onOsSandboxMissing?: (<DropdownMenuPrimitive.Item// my-0!: drops the menu item margin so it lines up with the question.className="my-0! shrink-0 cursor-pointer rounded-sm font-normal text-muted-foreground underline decoration-muted-foreground/50 underline-offset-[3px] outline-hidden transition-colors hover:text-foreground hover:decoration-foreground/60 data-[highlighted]:text-foreground data-[highlighted]:decoration-foreground/60"- // Deferred past the menu's focus restore.- onSelect={() =>- setTimeout(- () => openSettings("sandbox", { scrollTarget: "sandbox-permissions" }),- 0,- )- }+ onSelect={() => openExternalLink(SANDBOX_DOCS_URL)}>{t("settings.sandbox.learnMore")}</DropdownMenuPrimitive.Item>@@ -362,6 +356,7 @@ export function PermissionModeMenuItems({className={cn("items-start gap-2 py-2",permissionMode === option.value && "font-medium",+ option.value === "full" && "menu-item-full-access",)}><option.icon className="mt-0.5 size-4 shrink-0" strokeWidth={2} />@@ -486,7 +481,7 @@ export function FullAccessConfirmContent({<AlertDialogFooter className="mt-1"><AlertDialogCancel variant="muted">Cancel</AlertDialogCancel><AlertDialogAction variant="destructive" onClick={onConfirm}>- Turn on+ Confirm</AlertDialogAction></AlertDialogFooter></AlertDialogContent>diff --git a/studio/frontend/src/features/chat/sandbox-level.ts b/studio/frontend/src/features/chat/sandbox-level.tsindex 809bec0c983..46310a7b7f3 100644--- a/studio/frontend/src/features/chat/sandbox-level.ts+++ b/studio/frontend/src/features/chat/sandbox-level.ts@@ -5,6 +5,9 @@import type { SandboxCapability } from "./api/sandbox-capability";import type { PermissionMode, SandboxLevel } from "./stores/chat-runtime-store";+export const SANDBOX_DOCS_URL =+ "https://unsloth.ai/docs/new/studio/sandboxing-in-unsloth";+/** A settled answer says Python or Terminal runs without OS isolation. Unknown (no answer, an old* server) or still probing is not "missing". */export function osSandboxMissing(capability: SandboxCapability | null): boolean {diff --git a/studio/frontend/src/features/settings/tabs/sandbox-tab.tsx b/studio/frontend/src/features/settings/tabs/sandbox-tab.tsxindex 0c24fb4b58a..406c308605a 100644--- a/studio/frontend/src/features/settings/tabs/sandbox-tab.tsx+++ b/studio/frontend/src/features/settings/tabs/sandbox-tab.tsx@@ -15,6 +15,7 @@ import {forgetSandboxCapability,loadSandboxSetup,pickSandboxLevel,+ SANDBOX_DOCS_URL,sandboxSwitchState,startSandboxSetup,useActivePermissionMode,@@ -349,8 +350,6 @@ function SandboxLevelSection() {);}-const SANDBOX_DOCS_URL = "https://unsloth.ai/docs/new/studio/sandboxing-in-unsloth";-export function SandboxTab() {const t = useT();const isOwner = useIsAccountOwner();diff --git a/studio/frontend/src/index.css b/studio/frontend/src/index.cssindex f8734135e37..6b4bc3ac054 100644--- a/studio/frontend/src/index.css+++ b/studio/frontend/src/index.css@@ -291,6 +291,8 @@--destructive-button: #ce4035;/* Bypass permissions accent: bright, saturated yellow (not dark gold). */--bypass: #c99d00;+ /* Full access in permission menus: ChatGPT's orange, a touch yellower. */+ --full-access: #eb6702;--border-base: oklch(0.9208 0 0);--input-base: oklch(0.9208 0 0);--ring: #262626;@@ -470,6 +472,7 @@--destructive-button: #ed716a;/* Bypass permissions accent: bright, saturated neon yellow on dark. */--bypass: #ffd60a;+ --full-access: #ff8f30;/* One step lighter than --muted so outlines stay visible on muted surfaces; matches the hover tone. */--border-base: #3a3a3a;--input-base: #3a3a3a;@@ -1967,6 +1970,7 @@ html[data-chat-font] .aui-root {--color-border: var(--border);--color-destructive: var(--destructive);--color-bypass: var(--bypass);+ --color-full-access: var(--full-access);--color-accent-foreground: var(--accent-foreground);--color-accent: var(--accent);--color-muted-foreground: var(--muted-foreground);@@ -3863,6 +3867,14 @@ html[data-chat-font] .aui-root {.unsloth-plus-menu :is([data-slot="dropdown-menu-item"], [data-slot="context-menu-item"])[data-variant="destructive"]:is(:hover, :focus, :focus-visible, [data-highlighted]) {background-color: color-mix(in oklab, var(--destructive) 10%, transparent) !important;}+ /* After the hover ink's color: inherit, so the row stays orange highlighted. The unscoped pair+ covers menus without .unsloth-plus-menu (Run settings), over Radix's focus ink. */+ :is([data-slot="dropdown-menu-item"], [data-slot="context-menu-item"]).menu-item-full-access,+ :is([data-slot="dropdown-menu-item"], [data-slot="context-menu-item"]).menu-item-full-access *,+ .unsloth-plus-menu :is([data-slot="dropdown-menu-item"], [data-slot="context-menu-item"]).menu-item-full-access,+ .unsloth-plus-menu :is([data-slot="dropdown-menu-item"], [data-slot="context-menu-item"]).menu-item-full-access * {+ color: var(--full-access) !important;+ }/* nowrap so the menu sizes to "Preserve thinking". */.unsloth-thinking-menu :is(diff --git a/studio/frontend/tests/account-permissions.test.ts b/studio/frontend/tests/account-permissions.test.tsindex b55523f701a..e5086cb6b72 100644--- a/studio/frontend/tests/account-permissions.test.ts+++ b/studio/frontend/tests/account-permissions.test.ts@@ -39,6 +39,7 @@ function permissionUi(const levels: string[] = [];const popups: boolean[] = [];const opened: [string, unknown][] = [];+ const links: string[] = [];const capabilityStub = {loadSandboxCapability: async () => capability,loadSettledSandboxCapability: async () => capability,@@ -137,6 +138,7 @@ function permissionUi("@/lib/shield-alert-icon": { ShieldAlertGlyph: "ShieldAlertGlyph" },"@hugeicons/core-free-icons": {},"@/lib/tick-icon": {},+ "@/lib/open-link": { openExternalLink: (url: string) => links.push(url) },"@/lib/utils": { cn: () => "" },"@hugeicons/react": {},"./stores/chat-runtime-store": {@@ -147,7 +149,7 @@ function permissionUi(},},);- return { component, changes, levels, popups, opened };+ return { component, changes, levels, popups, opened, links };}for (const loginMode of ["single", "multi"]) {@@ -323,10 +325,12 @@ test("picking the level already in effect changes nothing", async () => {assert.deepEqual(ui.popups, []);});-test("Learn more beside the picker heading opens Settings > Sandbox at Permissions", async () => {+test("Learn more beside the picker heading opens the sandboxing docs", () => {const ui = permissionUi(true, "auto", "single", OS_SANDBOX);const { learnMore } = sandboxPicker(ui);(learnMore.props.onSelect as () => void)();- await until(() => ui.opened.length > 0);- assert.deepEqual(ui.opened, [["sandbox", "sandbox-permissions"]]);+ assert.deepEqual(ui.links, [+ "https://unsloth.ai/docs/new/studio/sandboxing-in-unsloth",+ ]);+ assert.deepEqual(ui.opened, []);});diff --git a/studio/frontend/tests/permission-mode-learn-more.test.ts b/studio/frontend/tests/permission-mode-learn-more.test.tsindex f1aef1e5635..a0785705fa0 100644--- a/studio/frontend/tests/permission-mode-learn-more.test.ts+++ b/studio/frontend/tests/permission-mode-learn-more.test.ts@@ -13,13 +13,15 @@ const SANDBOX_TAB = await readFile(new URL("../src/features/settings/tabs/sandbox-tab.tsx", import.meta.url),"utf8",);+const CSS = await readFile(new URL("../src/index.css", import.meta.url), "utf8");const OLD_GENERAL = await readFile(new URL("../src/features/settings/tabs/general-tab.tsx", import.meta.url),"utf8",);-test("the question mark opens the Permissions section of Settings > Sandbox", () => {- assert.match(MENU, /openSettings\("sandbox", \{ scrollTarget: "sandbox-permissions" \}\)/);+test("the picker's Learn more opens the sandboxing docs; Settings > Sandbox keeps its Permissions target", () => {+ assert.match(MENU, /onSelect=\{\(\) => openExternalLink\(SANDBOX_DOCS_URL\)\}/);+ assert.match(SANDBOX_TAB, /href=\{SANDBOX_DOCS_URL\}/);assert.match(SANDBOX_TAB, /if \(scrollTarget !== "sandbox-permissions"\) return;/);assert.match(SANDBOX_TAB, /ref=\{permissionsRef\}/);assert.doesNotMatch(OLD_GENERAL, /permissionsRef|PermissionModeDropdown|general-permissions/);@@ -105,7 +107,12 @@ test("menu descriptions stay to one short line", () => {for (const text of descriptions) assert.ok(text.length <= 60, text);});-test("Full access looks like every other level and asks in a short, neutral confirmation", () => {+test("Full access is orange in the menus and asks in a short, neutral confirmation", () => {+ assert.match(MENU, /option\.value === "full" && "menu-item-full-access",/);+ assert.match(CSS, /\.menu-item-full-access \* \{\s*color: var\(--full-access\) !important;/);+ // Run settings' dropdown has no .unsloth-plus-menu.+ assert.match(CSS, /^\t:is\(\[data-slot="dropdown-menu-item"\], \[data-slot="context-menu-item"\]\)\.menu-item-full-access,$/m);+ assert.match(MENU, /<AlertDialogAction variant="destructive" onClick=\{onConfirm\}>\s*Confirm\s*<\/AlertDialogAction>/);for (const source of [MENU, SANDBOX_TAB]) assert.doesNotMatch(source, /text-bypass|data-variant=\{fullAccess/);assert.match(MENU, /icon: ShieldAlertGlyph,/);assert.match(MENU, /Turn on Full access\?/);